2015-09-07 58 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格式。 –

相關問題