powershell 使用_如何使用PowerShell映射网络驱动器

powershell 使用_如何使用PowerShell映射网络驱动器

powershell 使用

powershell 使用_如何使用PowerShell映射网络驱动器

In years past, automating network drive creation required the use of primitive batch files, luckily for us you can now do it through PowerShell.

在过去的几年中,自动创建网络驱动器需要使用原始批处理文件,幸运的是,现在您可以通过PowerShell进行操作。

Note: this tutorial expects that you are using PowerShell 3.0.

注意:本教程期望您正在使用PowerShell 3.0。

如何使用PowerShell映射网络驱动器 (How to Map Network Drives Using PowerShell)

Prior to the PowerShell era, we could map networks drives using a batch file that contained a net use command:

在PowerShell时代之前,我们可以使用包含net use命令的批处理文件来映射网络驱动器:

net use M: \\touchsmart\Share /Persistent:Yes

净使用M:\\ touchsmart \ Share / Persistent:是

powershell 使用_如何使用PowerShell映射网络驱动器

To do it in PowerShell, press the Win + R keyboard combination to bring up a run box, then type powershell and hit enter.

要在PowerShell中进行操作,请按Win + R键盘组合以弹出运行框,然后键入powershell并按Enter。

powershell 使用_如何使用PowerShell映射网络驱动器

The Cmdlet we are looking for is New-PSDrive, but most importantly you need use the -Persist switch.

我们正在寻找的Cmdlet是New-PSDrive,但最重要的是,您需要使用-Persist开关。

New-PSDrive –Name “K” –PSProvider FileSystem –Root “\\touchsmart\share” –Persist

New-PSDrive –名称“ K” –PSProvider FileSystem –根“ \\ touchsmart \ share” –持久

Just change the name to a valid (not in use) drive letter and point the root parameter to a valid network share.

只需将名称更改为有效的(未使用)驱动器号,然后将根参数指向有效的网络共享。

powershell 使用_如何使用PowerShell映射网络驱动器

That’s all there is to it.

这里的所有都是它的。

翻译自: https://www.howtogeek.com/132354/how-to-map-network-drives-using-powershell/

powershell 使用