To view the contents from a PowerShell session: Get-ChildItem -Path M圜ompany: Example 4: Create a persistent mapped network drive using credentials PSProvider parameter to specify the PowerShell Registry provider. New-PSDrive uses the Name parameter to specify PowerShell drive named M圜ompany and the M圜ompany Registry HKLM:\Software\M圜ompany New-PSDrive -Name "M圜ompany" -PSProvider "Registry" -Root "HKLM:\Software\M圜ompany" It createsĪ drive named M圜ompany that is mapped to the HKLM:\Software\M圜ompany registry key. This example creates a temporary PowerShell drive that provides access to a registry key. To view the contents from a PowerShell session: Get-ChildItem -Path MyDocs: Example 3: Create a temporary drive for a registry key New-PSDrive uses the splatted parameters to create the MyDocs drive. The Description parameter describes the drive's Specifies the local computer's directory. The PSProvider parameter specifies the PowerShell FileSystem provider. The Name parameter specifies the drive name, Splatting creates the parameter keys and values. MyDocs FileSystem C:\Users\User01\Documents This example creates a temporary PowerShell drive that provides access to a directory on the localĭescription = "Maps to my My Documents folder." To view the contents from a PowerShell session: Get-ChildItem -Path Public: Example 2: Create a temporary drive mapped to a local directory PSProvider parameter to specify the PowerShell FileSystem provider. New-PSDrive uses the Name parameter to specify PowerShell drive named Public and the New-PSDrive -Name "Public" -PSProvider "FileSystem" -Root "\\Server01\Public" This example creates a temporary PowerShell drive that's mapped to a network share. Examples Example 1: Create a temporary drive mapped to a network share Unless you use the Scope parameter, PSDrives are created in the scope in which the Some code samples use splatting to reduce the line length and improve readability. Otherwise,Ĭredential isn't effective when you're creating new file system drives. Specified in the value of the Credential parameter is used to create the PSDrive. When the value of the Root parameter is a UNC path, such as \\Server\Share, the credential
0 Comments
Leave a Reply. |