Windows server2008 下 PowerShell对.NET3.5静默安装

Dim objShell,strCommonLine,strCommond1,strCommond2
Set objShell = CreateObject(WScript.Shell)
strCommonLine = "powershell.exe"
app = objShell.Run(strCommonLine)
objShell.AppActivate app

WScript.Sleep 100 
'对应角色功能列表命令
strCommond1 = "Import-Module ServerManager{ENTER}Add-WindowsFeature Application-Server,As-Web-Support,As-Ent-Services{ENTER}"
objShell.SendKeys strCommond1


WScript.Sleep 100
'退出操作
strCommond2 = "exit{ENTER}"
objShell.SendKeys strCommond2
WScript.quit

 

posted @ 2016-07-25 23:09  Zohar  阅读(999)  评论(0编辑  收藏  举报