Wednesday, August 8, 2018

PS 1.8.2 Working with File System

Below are some cmdlets you can use to work with cmdlets

cd \
dir
help dir 

cd training: # training is a psdrive 
dir | more
#lists just folders
dir -Directory
#list just files and recurse
dir -File -Recurse
#filtering is can by tricky
#this will work
dir .\*.txt 
dir -filter *.txt
#so will this if your recurse
dir -include *.txt -Recurse

help filesystem

PS 1.8.1 What is Powershell Drive ?

A Windows PowerShell drive 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 the file system drives (including C: and D:), the registry drives (HKCU: and HKLM:), and the certificate drive (Cert:), and you can create your own Windows PowerShell drives. These drives are very useful, but they are available only within Windows PowerShell. You cannot access them by using other Windows tools, such as File Explorer or Cmd.exe.


Get-Command -Noun PSdrive # gives list of commands  of psdrive
help Get-PSDrive  
Get-PSDrive # gives list of PSdrives

help New-PSDrive 
New-PSDrive -Name Training -PSProvider FileSystem -Root D:\Trainings # creates new psdrive
New-PSDrive i FileSystem -Root \\server\Trainings  # creates Network drive or Maps Network drive. 'I ' here is drive letter 
get-psdrive 


Featured Posts

Adding Accesspolicy to KeyVault for Service Principal Using Portal and Powershell

  Scripts path : https://drive.google.com/drive/folders/1sbBpnVFgXhUIXLdf2E9heyWDeU2f9427?usp=sharing  Adding Accesspolicy to KeyVault for S...