PSProvider: This denotes the provider that should be used for creating the drive. It accepts pipeline input, whereas wildcard characters are not permitted. The data type of this parameter is Switch. When a windows mapped drive is disconnected, the mapping is permanently deleted. The name of the drive can be any letter, whereas the root parameter should be a UNC. When the drive should persist indefinitely, a dot source should be used within the script. When the scope is set to local, PSDrive is created within the scope in which cmdlet is run without dot sourcing. To create permanent drives, it is needed to set the scope parameter as global. These types of drives are not session-specific, and they can be viewed and accessed through file explorer. Persist: This is used to create a window-associated network drive. This parameter accepts pipeline input, but wildcard characters are not permitted. The data type of this parameter is a string. For temporary PSDrives, any string can be used as the name. For permanent drive names, a letter can be used. Name: This is the name of the drive that is being created. To get a driver’s description, Get-PSDrive Drive name. To find the description of all the drives, Get-PSDrive | Description cmdlet can be used. Description: This denotes the description of the drive that is being created. The data type of this parameter is PSCredential. Username is stored in PSCredential object, and password is stored in the secure string format. By default, the current user’s credential is used. Credential: This represents the user account under which the cmdlet must be run. This parameter doesn’t accept both pipeline input as well as wildcard characters. The data type of this parameter is a switch. Confirm: This parameter is used to get confirmation from the user before running the cmdlet. While creating if a UNC path is specified in the root parameter, then the credential specified is used to create the PSDrive. Once the drive is disconnected, the mapping is also removed. In case of an external drive is connected to a system, a PSDrive is automatically added to the system by PowerShell. The best way to create a permanent mapping is to use the scope parameter and set its value to global. When the New-PSDrive cmdlet is used within a script and if the drive should be there indefinitely, then the script should be dot sourced. They are saved and can be accessed easily like other drives using file explorer. The persist parameter of this cmdlet is used to create mapped drives that are associated with windows. This cmdlet was introduced in PowerShell 3.0. Since the temporary drives are associated with PowerShell, they can not be accessed from file explorer, command prompt, WMI or. Temporary mapped drives are created whenever there is a need to access date and perform some operation. It can have any name and can be mapped to any remote computer, a directory or a data store. Temporary drives are available only in the current session of PowerShell. The New-PSDrive cmdlet is used for creating both temporary and permanent network mapped drives. The currently used method is by using the New-PSDrive cmdlet.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |