2015-09-07 56 views

回答

-1

这里结束的代码片段我使用。我通过arm模板启动自定义脚本扩展以启动powershell脚本

if (!(test-path c:\temp)) 
    { 
    mkdir c:\temp\ 
    } 
    #web deploy v3.6 
    $webdeployURL = 'https://download.microsoft.com/download/0/1/D/01DC28EA-638C-4A22-A57B-4CEF97755C6C/WebDeploy_amd64_en-US.msi' 
    $webdeployOutFileMSI = 'c:\temp\WebDeploy_amd64_en-US.msi' 
    wget -uri $webdeployURL -OutFile $webdeployOutFileMSI 

    $list = 
    @(
     "/I `"$webdeployOutFileMSI`"",      
     "/passive",        
     "ADDLOCAL=ALL LISTENURL=http://+:8080/MSWEBDEPLOY/", 
     "/L*V `"c:\temp\wdlog.log`""  
    ) 

    if ((get-windowsfeature Web-Mgmt-Service).InstallState -eq 'Installed') 
    { 
    Start-Process -FilePath "msiexec" -ArgumentList $list -Wait 
    } 
    else 
    { 
    Add-WindowsFeature Web-Mgmt-Service 
    Start-Process -FilePath "msiexec" -ArgumentList $list -Wait 
    } 

    Set-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\WebManagement\Server -Name EnableRemoteManagement -Value 1 
    Restart-Service wmsvc 

    if ((get-service -Name 'msdepsvc').Status -ne 'Running') 
    { 
    net start msdepsvc 
    } 

    netsh advfirewall firewall add rule name="Allow Web Management (WMSVC)" dir=in action=allow service="WMSVC" 
+0

关闭字符串全部为红色 – Phiter

+0

字符串关闭。这是SO格式。 –

相关问题