如何从PowerShell远程计算机中运行整个脚本?

时间:2018-01-22 11:57:12

标签: powershell

脚本

Enable-PSRemoting -Force
$username = ComputerName
$password = Password | ConvertTo-SecureString -Force -AsPlainText
$cred = New-Object -TypeName System.Management.Automation.PSCredential  $username, $password
$session = Enter-PSSession -ComputerName computername -Credential  $cred"

Set-Location -Path "C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE"
.\Mstest.exe /testsettings:"D:\folder1\Local.testsettings" /TestContainer:"D:\folder1\Webtest\AssetUpload_WT.webtest"    

当我在第一次运行中运行前5行而在第二次运行时运行最后2行时,它运行正常。

如何在PowerShell中运行整个脚本以使其起作用?

0 个答案:

没有答案