0
我的Azure帐户上有一台虚拟机,我想传递一个简单的应该只打开Microsoft Paint程序的powershell脚本。Azure自定义脚本停留在转换状态
PowerShell脚本是:
& "C:\Windows\system32\mspaint.exe"
这是提取的虚拟机,并试图在远程VM应用此脚本的代码。
var testingVm = _azure.VirtualMachines.GetById(
"...");
testingVm.Update()
.DefineNewExtension("InstallSoftware")
.WithPublisher("Microsoft.Compute")
.WithType("CustomScriptExtension")
.WithVersion("1.9")
.WithPublicSetting("fileUris", new string[]
{
"https://.../powershellscripts/OpenPaint.ps1"
})
.WithProtectedSetting("Url", "https://.../powershellscripts/gource-0.42-setup.exe")
.WithProtectedSetting("commandToExecute", "powershell -ExecutionPolicy Bypass -File OpenPaint.ps1")
.Attach()
.Apply();
的文件会下载和脚本被正确地放置在C:\包\插件\ Microsoft.Compute.CustomScriptExtension \ 1.9 \下载\ 0文件夹,BU涂料是不公开的,在Azure的门户网站的状态永远设置为“过渡”。 (我也确保vm已经在该目录中绘制,并且执行策略被设置为Bypass)。
我在做什么错?
正如额外的事情,我怎么会能够从这个C#代码参数传递给PowerShell脚本? – Iason
不能帮你那么伤心。从来没有用过c#sdk – 4c74356b41