SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Windows PowerShell Basics – Get PSDrive Info
i | P a g e
Table of Contents
Overview.......................................................................................................................................................1
Applies To..................................................................................................................................................1
Pre-Requisites ...........................................................................................................................................1
PowerShell Script – PSDrive Info...................................................................................................................1
Code Snippet – PSDrive.............................................................................................................................2
PowerShell Output – PSDrive................................................................................................................3
Windows PowerShell Basics – Get PSDrive Info
1 | P a g e
Overview
A Windows PowerShell Drive (PSDrive) is a data store location that you can access like a file system drive
in Windows PowerShell.
The Windows PowerShell providers create some drives for you, such as;
 File System Drives (including C: and D:),
 The Registry Drives (HKCU: and HKLM:),
 The Certificate Drive (Cert:)
You can create your own Windows PowerShell drives as well. These drives are very useful, though they
are available only within Windows PowerShell.
You cannot access them by using other Windows tools, such as File Explorer or Cmd.exe.
Applies To
Tested on Windows 10, Windows 2008 R2 and Windows 2012.
Pre-Requisites
Launch PowerShell Command Console or PowerShell ISE.
To run this script, Execution Policy should be set to either of these “AllSigned” or “RemoteSigned” or
“Unrestricted”, you can get current execution policy by running the command; “Get-ExecutionPolicy”.
Each Policy type and its purpose is shown in the below table.
Policy Type Purpose
Restricted No scripts can be run. Windows PowerShell can be used only in interactive mode.
AllSigned Only scripts signed by a trusted publisher can be run.
RemoteSigned Downloaded scripts must be signed by a trusted publisher before they can be run.
Unrestricted No restrictions; all Windows PowerShell scripts can be run.
PowerShell Script – PSDrive Info
This PowerShell script demonstrates retrieving PowerShell Drive (PSDrive) Information in PowerShell
console.
Windows PowerShell uses the noun PSDrive, additional you can retrieve information as below;
Windows PowerShell Basics – Get PSDrive Info
2 | P a g e
Code Snippet – PSDrive
The code snippet is for demonstrating “PSDrive” information listing, Windows PowerShell uses the noun,
PSDrive. This script will retrieve the available PowerShell drives on to a HTML file.
Clear-Host
#
# Set Output Path and File
#
Set-Location -Path $env:USERPROFILE
Push-Location -Path $env:USERPROFILE
$OutputFile="PSDrives_Info.html"
#
# Remove Old File
#
if ($OutputFile) {
Remove-Item $OutputFile
}
#
# Set HTML Header
#
$Header = @"
<style>
TABLE {border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse;}
TH {border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: red;}
TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black;}
</style>
"@
Get-PSDrive | ConvertTo-Html -Property Name,Used,Provider,Root,CurrentLocation -Head $Header |
Out-File -FilePath $OutputFile
Invoke-Item $OutputFile
Windows PowerShell Basics – Get PSDrive Info
3 | P a g e
PowerShell Output – PSDrive
When script is executed; below output will be displayed.

More Related Content

What's hot (20)

PDF
Install and Configure RSyslog – CentOS 7 / RHEL 7
VCP Muthukrishna
 
PDF
How To Connect To Active Directory PowerShell
VCP Muthukrishna
 
PDF
How To Create PowerShell Function
VCP Muthukrishna
 
PDF
How To Check and Delete a File via PowerShell
VCP Muthukrishna
 
PDF
Install Active Directory PowerShell Module on Windows 10
VCP Muthukrishna
 
PDF
How To List Nginx Modules Installed / Complied on CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Configure Open SSH Server on Ubuntu
VCP Muthukrishna
 
PDF
How To List Files and Display In HTML Format
VCP Muthukrishna
 
PDF
How To Install and Configure SNMP on RHEL 7 or CentOS 7
VCP Muthukrishna
 
PDF
How To View Current Execution Policy PowerShell
VCP Muthukrishna
 
PDF
How To Setup SSH Keys on CentOS 7
VCP Muthukrishna
 
PDF
How To Connect Amazon AWS EC2 with Key Pair – Linux
VCP Muthukrishna
 
PDF
Bash Script - How To Monitor Application Error Logs and Send Notification
VCP Muthukrishna
 
PDF
How To List Files on Remote Server - PowerShell
VCP Muthukrishna
 
PDF
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
VCP Muthukrishna
 
DOCX
How to Configure Amazon AWS EC2 Elastic IP Address
VCP Muthukrishna
 
PDF
How To Install and Configure Apache SSL on CentOS 7
VCP Muthukrishna
 
PDF
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
VCP Muthukrishna
 
PDF
How To Manage Linux User on RHEL 7
VCP Muthukrishna
 
PDF
How to Install and Configure Cacti on Linux
VCP Muthukrishna
 
Install and Configure RSyslog – CentOS 7 / RHEL 7
VCP Muthukrishna
 
How To Connect To Active Directory PowerShell
VCP Muthukrishna
 
How To Create PowerShell Function
VCP Muthukrishna
 
How To Check and Delete a File via PowerShell
VCP Muthukrishna
 
Install Active Directory PowerShell Module on Windows 10
VCP Muthukrishna
 
How To List Nginx Modules Installed / Complied on CentOS 7
VCP Muthukrishna
 
How To Install and Configure Open SSH Server on Ubuntu
VCP Muthukrishna
 
How To List Files and Display In HTML Format
VCP Muthukrishna
 
How To Install and Configure SNMP on RHEL 7 or CentOS 7
VCP Muthukrishna
 
How To View Current Execution Policy PowerShell
VCP Muthukrishna
 
How To Setup SSH Keys on CentOS 7
VCP Muthukrishna
 
How To Connect Amazon AWS EC2 with Key Pair – Linux
VCP Muthukrishna
 
Bash Script - How To Monitor Application Error Logs and Send Notification
VCP Muthukrishna
 
How To List Files on Remote Server - PowerShell
VCP Muthukrishna
 
How To Create EBS Snapshot and Restore EBS Snapshot – Linux Instance
VCP Muthukrishna
 
How to Configure Amazon AWS EC2 Elastic IP Address
VCP Muthukrishna
 
How To Install and Configure Apache SSL on CentOS 7
VCP Muthukrishna
 
Zimbra Troubleshooting - Mails not being Delivered or Deferred or Connection ...
VCP Muthukrishna
 
How To Manage Linux User on RHEL 7
VCP Muthukrishna
 
How to Install and Configure Cacti on Linux
VCP Muthukrishna
 

Similar to Windows PowerShell Basics - How To List PSDrive Info (20)

PDF
Manage your infrastructure with PowerShell
Jaap Brasser
 
PPTX
Powershell for Log Analysis and Data Crunching
Michelle D'israeli
 
PPT
PowerShell Core Skills (TechMentor Fall 2011)
Concentrated Technology
 
PPT
No-script PowerShell v2
Concentrated Technology
 
PPTX
Powering up on PowerShell - BSides Greenville 2019
Fernando Tomlinson, CISSP, MBA
 
PPTX
44CON London 2015: NTFS Analysis with PowerForensics
Jared Atkinson
 
PPTX
CCI2019 - I've got the Power! I've got the Shell!
walk2talk srl
 
PPTX
Power forensics
nullowaspmumbai
 
PPTX
PowerShell for Cyber Warriors - Bsides Knoxville 2016
Russel Van Tuyl
 
PDF
Reach the next level with PowerShell
Jaap Brasser
 
PPTX
Powering up on power shell avengercon - 2018
Fernando Tomlinson, CISSP, MBA
 
PPTX
Power shell training
David Brabant
 
PPTX
The Power of PowerShell: Advanced
Microsoft TechNet - Belgium and Luxembourg
 
PDF
BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1
Michael Gough
 
PPTX
Windows power shell basics
Dan Morrill
 
PPTX
VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...
VMworld
 
PPTX
Getting Started With PowerShell Scripting
Ravikanth Chaganti
 
PPTX
Powershell_Basics_Robin
Robin Aggarwal
 
PPSX
Sunil phani's take on windows powershell
Sunil Phani
 
PPTX
Basic PowerShell Toolmaking - Spiceworld 2016 session
Rob Dunn
 
Manage your infrastructure with PowerShell
Jaap Brasser
 
Powershell for Log Analysis and Data Crunching
Michelle D'israeli
 
PowerShell Core Skills (TechMentor Fall 2011)
Concentrated Technology
 
No-script PowerShell v2
Concentrated Technology
 
Powering up on PowerShell - BSides Greenville 2019
Fernando Tomlinson, CISSP, MBA
 
44CON London 2015: NTFS Analysis with PowerForensics
Jared Atkinson
 
CCI2019 - I've got the Power! I've got the Shell!
walk2talk srl
 
Power forensics
nullowaspmumbai
 
PowerShell for Cyber Warriors - Bsides Knoxville 2016
Russel Van Tuyl
 
Reach the next level with PowerShell
Jaap Brasser
 
Powering up on power shell avengercon - 2018
Fernando Tomlinson, CISSP, MBA
 
Power shell training
David Brabant
 
The Power of PowerShell: Advanced
Microsoft TechNet - Belgium and Luxembourg
 
BSidesOK_You_CAN_detect_PowerShell_attacks_v1.1
Michael Gough
 
Windows power shell basics
Dan Morrill
 
VMworld 2016: Getting Started with PowerShell and PowerCLI for Your VMware En...
VMworld
 
Getting Started With PowerShell Scripting
Ravikanth Chaganti
 
Powershell_Basics_Robin
Robin Aggarwal
 
Sunil phani's take on windows powershell
Sunil Phani
 
Basic PowerShell Toolmaking - Spiceworld 2016 session
Rob Dunn
 
Ad

More from VCP Muthukrishna (12)

PDF
How to Fix Duplicate Packages in YUM on CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Configure GNome on CentOS 7
VCP Muthukrishna
 
PDF
How To Configure Nginx Load Balancer on CentOS 7
VCP Muthukrishna
 
PDF
Nginx bind() to 0.0.0.0:9080 failed
VCP Muthukrishna
 
PDF
How To Install and Configure Screen on CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Configure Salt Master on Ubuntu
VCP Muthukrishna
 
PDF
How To Protect SSH Access with Fail2Ban on RHEL 7
VCP Muthukrishna
 
PDF
How To Configure SNMP Logging on RHEL 7
VCP Muthukrishna
 
PDF
How To Find Package Installation Date on RHEL 7
VCP Muthukrishna
 
PDF
How to Upgrade Openfire on CentOS 7
VCP Muthukrishna
 
PDF
How To Reset root Password on CentOS 7
VCP Muthukrishna
 
PDF
How To Install and Use ABRT CLI on RHEL 7
VCP Muthukrishna
 
How to Fix Duplicate Packages in YUM on CentOS 7
VCP Muthukrishna
 
How To Install and Configure GNome on CentOS 7
VCP Muthukrishna
 
How To Configure Nginx Load Balancer on CentOS 7
VCP Muthukrishna
 
Nginx bind() to 0.0.0.0:9080 failed
VCP Muthukrishna
 
How To Install and Configure Screen on CentOS 7
VCP Muthukrishna
 
How To Install and Configure Salt Master on Ubuntu
VCP Muthukrishna
 
How To Protect SSH Access with Fail2Ban on RHEL 7
VCP Muthukrishna
 
How To Configure SNMP Logging on RHEL 7
VCP Muthukrishna
 
How To Find Package Installation Date on RHEL 7
VCP Muthukrishna
 
How to Upgrade Openfire on CentOS 7
VCP Muthukrishna
 
How To Reset root Password on CentOS 7
VCP Muthukrishna
 
How To Install and Use ABRT CLI on RHEL 7
VCP Muthukrishna
 
Ad

Recently uploaded (20)

PDF
Staying Human in a Machine- Accelerated World
Catalin Jora
 
PDF
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
PDF
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
PDF
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PDF
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Mastering Financial Management in Direct Selling
Epixel MLM Software
 
Staying Human in a Machine- Accelerated World
Catalin Jora
 
How Startups Are Growing Faster with App Developers in Australia.pdf
India App Developer
 
The Rise of AI and IoT in Mobile App Tech.pdf
IMG Global Infotech
 
LOOPS in C Programming Language - Technology
RishabhDwivedi43
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
POV_ Why Enterprises Need to Find Value in ZERO.pdf
darshakparmar
 
July Patch Tuesday
Ivanti
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Biography of Daniel Podor.pdf
Daniel Podor
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
Transforming Utility Networks: Large-scale Data Migrations with FME
Safe Software
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Mastering Financial Management in Direct Selling
Epixel MLM Software
 

Windows PowerShell Basics - How To List PSDrive Info

  • 1. Windows PowerShell Basics – Get PSDrive Info i | P a g e Table of Contents Overview.......................................................................................................................................................1 Applies To..................................................................................................................................................1 Pre-Requisites ...........................................................................................................................................1 PowerShell Script – PSDrive Info...................................................................................................................1 Code Snippet – PSDrive.............................................................................................................................2 PowerShell Output – PSDrive................................................................................................................3
  • 2. Windows PowerShell Basics – Get PSDrive Info 1 | P a g e Overview A Windows PowerShell Drive (PSDrive) is a data store location that you can access like a file system drive in Windows PowerShell. The Windows PowerShell providers create some drives for you, such as;  File System Drives (including C: and D:),  The Registry Drives (HKCU: and HKLM:),  The Certificate Drive (Cert:) You can create your own Windows PowerShell drives as well. These drives are very useful, though they are available only within Windows PowerShell. You cannot access them by using other Windows tools, such as File Explorer or Cmd.exe. Applies To Tested on Windows 10, Windows 2008 R2 and Windows 2012. Pre-Requisites Launch PowerShell Command Console or PowerShell ISE. To run this script, Execution Policy should be set to either of these “AllSigned” or “RemoteSigned” or “Unrestricted”, you can get current execution policy by running the command; “Get-ExecutionPolicy”. Each Policy type and its purpose is shown in the below table. Policy Type Purpose Restricted No scripts can be run. Windows PowerShell can be used only in interactive mode. AllSigned Only scripts signed by a trusted publisher can be run. RemoteSigned Downloaded scripts must be signed by a trusted publisher before they can be run. Unrestricted No restrictions; all Windows PowerShell scripts can be run. PowerShell Script – PSDrive Info This PowerShell script demonstrates retrieving PowerShell Drive (PSDrive) Information in PowerShell console. Windows PowerShell uses the noun PSDrive, additional you can retrieve information as below;
  • 3. Windows PowerShell Basics – Get PSDrive Info 2 | P a g e Code Snippet – PSDrive The code snippet is for demonstrating “PSDrive” information listing, Windows PowerShell uses the noun, PSDrive. This script will retrieve the available PowerShell drives on to a HTML file. Clear-Host # # Set Output Path and File # Set-Location -Path $env:USERPROFILE Push-Location -Path $env:USERPROFILE $OutputFile="PSDrives_Info.html" # # Remove Old File # if ($OutputFile) { Remove-Item $OutputFile } # # Set HTML Header # $Header = @" <style> TABLE {border-width: 1px; border-style: solid; border-color: black; border-collapse: collapse;} TH {border-width: 1px; padding: 3px; border-style: solid; border-color: black; background-color: red;} TD {border-width: 1px; padding: 3px; border-style: solid; border-color: black;} </style> "@ Get-PSDrive | ConvertTo-Html -Property Name,Used,Provider,Root,CurrentLocation -Head $Header | Out-File -FilePath $OutputFile Invoke-Item $OutputFile
  • 4. Windows PowerShell Basics – Get PSDrive Info 3 | P a g e PowerShell Output – PSDrive When script is executed; below output will be displayed.