【发布时间】:2016-10-22 18:25:59
【问题描述】:
您好,有人可以帮我以管理员身份从 vbscript 运行 powershell
VB 脚本
MyPath = "c:\temp\folder1" 暗淡 objShell 设置 objShell = CreateObject("Wscript.Shell") objShell.run("powershell.exe -noexit -file C:\temp\power.ps1 " & MyPath)
PowerShell power.ps1
C:\temp\psfile.exe $args[0] -c
【问题讨论】:
-
为什么要尝试运行 PowerShell 脚本来运行外部命令,而不是直接从 VBScript 运行外部命令?
-
Hi psfile 命令将使用管理员用户名和密码,并且必须放入外部文件...
-
我必须使用 psfile 命令关闭在 rempte 共享中打开的文件夹/子文件夹中的所有连接。在 psfile 我必须使用远程服务器管理员 ID 和密码来实现这一点
-
嗨,有人可以帮助我以管理员身份从 vbscript 运行 powershell VB 脚本 ----------- MyPath = "c:\temp\folder1" Dim objShell Set objShell = CreateObject("Wscript.Shell") objShell.run("powershell.exe -noexit -file C:\temp\power.ps1 " & MyPath) PowerShell power.ps1 -------------- -------- C:\temp\psfile.exe $args[0] -c
标签: powershell vbscript