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
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
PPTX
The Future of AI & Machine Learning.pptx
pritsen4700
 
PPTX
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
PPTX
Simple and concise overview about Quantum computing..pptx
mughal641
 
PDF
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
PDF
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
PDF
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
PPTX
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PDF
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
PPTX
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
PDF
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
PDF
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
PPTX
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PPTX
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
PPTX
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
PDF
The Future of Artificial Intelligence (AI)
Mukul
 
OFFOFFBOX™ – A New Era for African Film | Startup Presentation
ambaicciwalkerbrian
 
The Future of AI & Machine Learning.pptx
pritsen4700
 
AI Code Generation Risks (Ramkumar Dilli, CIO, Myridius)
Priyanka Aash
 
Simple and concise overview about Quantum computing..pptx
mughal641
 
A Strategic Analysis of the MVNO Wave in Emerging Markets.pdf
IPLOOK Networks
 
Tea4chat - another LLM Project by Kerem Atam
a0m0rajab1
 
Economic Impact of Data Centres to the Malaysian Economy
flintglobalapac
 
IT Runs Better with ThousandEyes AI-driven Assurance
ThousandEyes
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Google I/O Extended 2025 Baku - all ppts
HusseinMalikMammadli
 
cloud computing vai.pptx for the project
vaibhavdobariyal79
 
Peak of Data & AI Encore - Real-Time Insights & Scalable Editing with ArcGIS
Safe Software
 
The Future of Mobile Is Context-Aware—Are You Ready?
iProgrammer Solutions Private Limited
 
Farrell_Programming Logic and Design slides_10e_ch02_PowerPoint.pptx
bashnahara11
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
CIFDAQ's Market Wrap : Bears Back in Control?
CIFDAQ
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
AI in Daily Life: How Artificial Intelligence Helps Us Every Day
vanshrpatil7
 
Agile Chennai 18-19 July 2025 | Workshop - Enhancing Agile Collaboration with...
AgileNetwork
 
The Future of Artificial Intelligence (AI)
Mukul
 

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.