-Persist [<SwitchParameter>]
Indicates that this cmdlet creates a Windows mapped network drive.
Mapped network drives are saved in Windows on the local computer. They
are persistent, not session-specific, and can be viewed and managed in
File Explorer and other tools.
When you scope the command locally, that is, without dot-sourcing, the Persist parameter does not persist the creation of a
PSDrive beyond the scope in which you run the command. If you run
New-PSDrive inside a script, and you want the new drive to persist
indefinitely, you must dot-source the script. For best results, to
force a new drive to persist, specify Global as the value of the Scope
parameterin addition to adding Persist to your
command.
The name of the drive must be a letter, such as D or E. The value of Root parameter must be a UNC path of a different computer. The
value of the PSProvider parameter must be FileSystem.
To disconnect a Windows mapped network drive, use the Remove-PSDrive cmdlet. When you disconnect a Windows mapped network
drive, the mapping is permanently deleted from the computer, not just
deleted from the current session.
Mapped network drives are specific to a user account. Mapped network drives that you create in sessions that are started by using
the Run as administrator option or by using the credential of another
user are not visible in a session that was started without explicit
credentials, or by using the credentials of the current user.
New-PSDrive
是 PowerShell 中等同于net use
的命令。 - Maximilian BurszleyGet-PSDrive
中看到驱动器吗? - Maximilian Burszley