Maa*_*ers 2 deployment iis vps azure devops
我无法让我的注册脚本在 PowerShell (admin) 中运行。它可以在 Powershell ISE 中运行,但随后脚本卡在“正在连接到服务器...”
\n难道我做错了什么?
\n\n这是脚本:
\n $ErrorActionPreference="Stop";If(-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent() ).IsInRole( [Security.Principal.WindowsBuiltInRole] \xe2\x80\x9cAdministrator\xe2\x80\x9d)){ throw "Run command in an administrator PowerShell prompt"};If($PSVersionTable.PSVersion -lt (New-Object System.Version("3.0"))){ throw "The minimum version of Windows PowerShell that is required by the script (3.0) does not match the currently running version of Windows PowerShell." };If(-NOT (Test-Path $env:SystemDrive\\\'azagent\')){mkdir $env:SystemDrive\\\'azagent\'}; cd $env:SystemDrive\\\'azagent\'; for($i=1; $i -lt 100; $i++){$destFolder="A"+$i.ToString();if(-NOT (Test-Path ($destFolder))){mkdir $destFolder;cd $destFolder;break;}}; $agentZip="$PWD\\agent.zip";$DefaultProxy=[System.Net.WebRequest]::DefaultWebProxy;$securityProtocol=@();$securityProtocol+=[Net.ServicePointManager]::SecurityProtocol;$securityProtocol+=[Net.SecurityProtocolType]::Tls12;[Net.ServicePointManager]::SecurityProtocol=$securityProtocol;$WebClient=New-Object Net.WebClient; $Uri=\'[url]\';if($DefaultProxy -and (-not $DefaultProxy.IsBypassed($Uri))){$WebClient.Proxy= New-Object Net.WebProxy($DefaultProxy.GetProxy($Uri).OriginalString, $True);}; $WebClient.DownloadFile($Uri, $agentZip);Add-Type -AssemblyName System.IO.Compression.FileSystem;[System.IO.Compression.ZipFile]::ExtractToDirectory( $agentZip, "$PWD");.\\config.cmd --deploymentgroup --deploymentgroupname "Production" --agent $env:COMPUTERNAME --runasservice --work \'_work\' --url \'[devopsUrl]\' --projectname \'Storms\' --auth PAT --token [token]; Remove-Item $agentZip;\nRun Code Online (Sandbox Code Playgroud)\n
引号是问题所在。引号有多种类型,根据您的居住国家/地区,这可能会导致问题。
\n可以通过删除“管理员”周围的引号并手动将其添加回来来解决此问题。
\n您可以在这里看到区别:\n\xe2\x80\x9cAdministrator\xe2\x80\x9d 与“管理员”
\n注意到引号中的区别了吗?第一对是美国版,第二对是欧洲版。
\n| 归档时间: |
|
| 查看次数: |
807 次 |
| 最近记录: |