如何在远程机器中映射网络驱动器.. [英] How to map a network drive in remote machine ..

查看:532
本文介绍了如何在远程机器中映射网络驱动器..的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



任何人都可以帮助我远程使用PowerShell映射驱动器。



我尝试了以下脚本



Hi all

Can anyone help me how to map a drive using powershell remotely.

I tried the below script

$computername = (Read-Host "Enter Remote computer to map a drive to")

Invoke-Command =scriptslock{
	$drivename = (Read-Host "Enter Drive Letter e.g. X:")
	$psprovider = (Read-Host "Enter psprovider e.g.filesystem")
	$server= (Read-Host "Name of the share you like to map")
	New-PSDrive $drivename -PSProvider -Root \\$server\$share -Persist -credential $admincredentials
} -ComputerName $computername





但它只在本地机器上创建驱动器。



请分享任何想法。



谢谢



But it is creating the drive at local machine only.

Please share any idea on this.

Thank you

推荐答案

computername =(Read-Host输入远程计算机以将驱动器映射到)

Invoke-Command = scriptslock {
computername = (Read-Host "Enter Remote computer to map a drive to") Invoke-Command =scriptslock{


driv ename =(读取主机输入驱动器号,例如X:)
drivename = (Read-Host "Enter Drive Letter e.g. X:")


psprovider =(Read-Host输入psprovider egfilesystem)
psprovider = (Read-Host "Enter psprovider e.g.filesystem")


这篇关于如何在远程机器中映射网络驱动器..的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆