帝王谷资源网 Design By www.wdxyy.com
Install.vbs
发布者 Microsoft Corporation 脚本专家
此脚本由 scenario1.vbs 在一台网络主机上启动。Install.vbs 可以在安装了 SP2 的主机上以本地方式运行,它执行以下任务:
? 从一台远程服务器运行 SP2 安装程序。
? 在主机上设置 AutoAdmin 和 RunOnce 两个注册表项。
? 将结果记录到文本文件 computername-sp2-instlog.txt 并将该文件复制回管理工作站。
? 强制重新启动,随后 runonce.vbs 将自动启动。
在基本方案中,SP 2 安装程序文件位于列表中的所有网络主机均可访问的一台远程服务器上。在该方案的某种变化方案中,如果将 SP 2 安装程序复制到本地主机并从这里运行,则应重命名此脚本(例如重命名为 install-remote.vbs),然后将 install-local.vbs 重命名为 install.vbs。您还必须对这些脚本中提到的 scenario1.vbs 和新的 install.vbs 做一些细微更改。
有关方案 1 以及各个脚本的作用的进一步说明,请参见对这些脚本的介绍,网址是:
http://www.microsoft.com/technet/scriptcenter/solutions/appcompat.msxp
Install.vbs 对应于 install.cmd,但增加了一些新功能;install.cmd 是 Application Compatibility Testing and Mitigation Guide for Windows XP Service Pack 2(Windows XP Service Pack 2 应用程序兼容性测试和缓解指南)“附录”中介绍的附带脚本之一。您可以从以下网址下载用来安装该指南及其关联脚本的 Windows Installer (.msi) 文件:
http://www.microsoft.com/downloads/details.aspx?FamilyId=9300BECF-2DEE-4772-ADD9-AD0EAF89C4A7&displaylang=en
要使用此脚本,请复制代码,将代码粘贴到记事本中,然后将脚本另存为 install.vbs。此脚本被设计成了作为 scenario1.vbs 启动的进程的一部分自动运行。
脚本代码
复制代码 代码如下:
'******************************************************************************
'install.vbs
'Author: Peter Costantini, the Microsoft Scripting Guys
'Date: 9/1/04
'Must be deployed to a client and launched remotely by scenario1.vbs.
'Assumes that runonce.vbs is in same directory as script.
'Assumes that Windows XP Service Pack 2 setup program is on a remote server
'and runonce.vbs are in same directory as script.
'1. Runs Service Pack 2 setup program from remote server to install
' Windows XP Service Pack 2. This could take one or two hours.
'2. Configures the AutoAdmin and RunOnce registry settings necessary
' to run runonce.vbs.
'3. Logs results to text file, <computername>-sp2-instlog.txt and copies
' the file back to admin workstation.
'4. Forces a reboot of the local machine so that the AutoAdmin and RunOnce
' registry settings take effect.
'******************************************************************************
On Error Resume Next
'Initialize global constants and variables.
Const FOR_APPENDING = 8
g_strLocalFolder = "c:\temp-ac"
'Change name of computer to actual administrative workstation or local
'path to which log should be copied.
g_strRemoteFolder = "\\<adminwkstn>\c$\temp-ac"
'Get computer name.
g_strComputer = GetComputerName
g_strLogFile = g_strComputer & "-sp2-instlog.txt"
'Create log file.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextStream = objFSO.OpenTextFile(g_strLogFile, FOR_APPENDING, True)
objTextStream.WriteLine "Windows XP Service Pack 2 " & _
"Installation and Configuration Log: Phase 1"
objTextStream.WriteLine Now
objTextStream.WriteLine g_strComputer
objTextStream.WriteLine String(Len(g_strComputer), "-")
'Handle logic of calling functions and sub-routines to install Service Pack 2
'and configure AutoAdministration.
blnInstallSP = InstallSP
If blnInstallSP = False Then
CopyLog
WScript.Quit
End If
blnAutoAdmin = ConfigAutoAdmin
If blnAutoAdmin = False Then
CopyLog
WScript.Quit
End If
Reboot
'******************************************************************************
Function GetComputerName
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\." _
&"\root\cimv2")
Set colSystems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
For Each objSytem In colSystems
GetComputerName = objSytem.Name
Next
End Function
'******************************************************************************
Function InstallSP
'Edit this line to include the server and share name where the Windows XP
'Service Pack 2 setup program is located.
strInstallPath = "\\servername\xpsp2\WindowsXP-KB835935-SP2-ENU.exe " & _
"/quiet /norestart /o"
Set WshShell = CreateObject("Wscript.Shell")
Set objExec = WshShell.Exec(strInstallPath)
'This could take one or two hours.
objTextStream.WriteLine "Installation started ..."
If Err = 0 Then
'Loop until Exec is finished - Status = 1.
Do While objExec.Status = 0
'Pause for 10 seconds before checking.
'To reduce network traffic, make interval longer.
WScript.Sleep 10000
Loop
objTextStream.WriteLine "Service Pack 2 installation completed."
InstallSP = True
Else
objTextStream.WriteLine "Unable to install Service Pack 2." & VbCrLf & _
"Error connecting to Service Pack 2 on server." & VbCrLf & _
"Error number: " & Err.Number & VbCrLf & _
"Error source: " & Err.Source & VbCrLf & _
"Error description: " & Err.Description
InstallSP = False
End If
Err.Clear
End Function
'******************************************************************************
Function ConfigAutoAdmin
Const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath1 = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
strKeyPath2 = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
strDefaultUserName = "Administrator"
strDefaultPassword = "P@ssw0rd"
strDefaultDomainName = "Contoso"
intAutoAdminLogon = 1
strRunOnceEntry = "MyScript"
strRunoncePath = g_strLocalFolder & "\runonce.vbs"
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
g_strComputer & "\root\default:StdRegProv")
'Set strDefaultUserName to user with Administrator credentials.
intRet1 = objReg.SetStringValue(HKEY_LOCAL_MACHINE, strKeyPath1, _
"DefaultUserName", strDefaultUserName)
If intRet1 <> 0 Then
objTextStream.WriteLine "Error: DefaultUserName not configured."
End If
'Set strDefaultPassword to password of default username.
intRet2 = objReg.SetStringValue(HKEY_LOCAL_MACHINE, strKeyPath1, _
"DefaultPassword", strDefaultPassword)
If intRet2 <> 0 Then
objTextStream.WriteLine "Error: DefaultPassword not configured."
End If
'Uncomment next 5 lines and edit last parameter if default domain
'for the credentials is different from that already set.
'intRet3 = objReg.SetStringValue(HKEY_LOCAL_MACHINE, strKeyPath1, _
' "DefaultDomainName", strDefaultDomainName)
'If intRet3 <> 0 Then
' objTextStream.WriteLine "Error: DefaultDomainName not configured."
'End If
'Turn on AutoAdminLogon
intRet4 = objReg.SetStringValue(HKEY_LOCAL_MACHINE, strKeyPath1, _
"AutoAdminLogon", "1")
If intRet4 <> 0 Then
objTextStream.WriteLine "Error: AutoAdminLogon not configured."
End If
'Add MyScript entry to RunOnce subkey.
intRet5 = objReg.SetStringValue(HKEY_LOCAL_MACHINE, strKeyPath2, _
strRunOnceEntry, strRunoncePath)
If intRet5 <> 0 Then
objTextStream.WriteLine "Error: MyScript RunOnce entry not configured."
End If
'Check that all registry write operations succeeded.
If (intRet1 + intRet2 + intRet3 + intRet4 + intRet5) = 0 Then
objTextStream.WriteLine "AutoAdminLogon and RunOnce configured."
ConfigAutoAdmin = True
Else
objTextStream.WriteLine "Error: AutoAdminLogon and RunOnce not fully " & _
"configured."
ConfigAutoAdmin = False
End If
End Function
'******************************************************************************
Sub Reboot
Const FORCED_REBOOT = 6
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate," & _
"(Shutdown)}!\\" & g_strComputer & "\root\cimv2")
Set colOSes = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
objTextStream.WriteLine "Attempting to reboot ..."
CopyLog
For Each objOS In colOSes 'Only one objOS in collection
intReturn = objOS.Win32Shutdown(FORCED_REBOOT)
If intReturn <> 0 Then
Set objTextStream = objFSO.OpenTextFile(g_strLogFile, FOR_APPENDING, True)
objTextStream.WriteLine Now
objTextStream.WriteLine "Error: Unable to reboot. " & VbCrLf & _
"Return code: " & intReturn
CopyLog
End If
Next
End Sub
'******************************************************************************
Sub CopyLog
'Close text file.
objTextStream.WriteLine "Closing log and attempting to copy file to " & _
"administrative workstation."
objTextStream.WriteLine
objTextStream.WriteLine String(80, "-")
objTextStream.WriteLine
objTextStream.Close
'Copy log.
If Not objFSO.FolderExists(g_strRemoteFolder) Then
objFSO.CreateFolder(g_strRemoteFolder)
If Err <> 0 Then
Err.Clear
Exit Sub
End If
End If
objFSO.CopyFile g_strLogFile, g_strRemoteFolder & "\"
End Sub
要获得在线同行支持,请加入 msnews.microsoft.com 新闻服务器上的 microsoft.public.windows.server.scripting 社区。要提供反馈或报告示例脚本或“脚本指南”中的错误,请联系 Microsoft TechNet。
免责声明
此示例脚本不受任何 Microsoft 标准支持计划或服务的支持。这里仅按原样提供示例脚本,而不作任何类型的担保。Microsoft 进一步明确拒绝所有的暗示担保,包括但不限于对适销性或对特定目的适用性的任何暗示担保。使用或执行示例脚本和文档所引起的全部风险应由您自己承担。在任何情况下,对于使用或不能使用示例脚本或文档所引起的任何损害(包括但不限于商业利润损失、业务中断、商业信息丢失或其他资金损失所造成的损害),Microsoft、其作者以及参与脚本创建、生产或传递的任何其他人员都概不负责,即使 Microsoft 已被告知存在这些损害的可能性。
发布者 Microsoft Corporation 脚本专家
此脚本由 scenario1.vbs 在一台网络主机上启动。Install.vbs 可以在安装了 SP2 的主机上以本地方式运行,它执行以下任务:
? 从一台远程服务器运行 SP2 安装程序。
? 在主机上设置 AutoAdmin 和 RunOnce 两个注册表项。
? 将结果记录到文本文件 computername-sp2-instlog.txt 并将该文件复制回管理工作站。
? 强制重新启动,随后 runonce.vbs 将自动启动。
在基本方案中,SP 2 安装程序文件位于列表中的所有网络主机均可访问的一台远程服务器上。在该方案的某种变化方案中,如果将 SP 2 安装程序复制到本地主机并从这里运行,则应重命名此脚本(例如重命名为 install-remote.vbs),然后将 install-local.vbs 重命名为 install.vbs。您还必须对这些脚本中提到的 scenario1.vbs 和新的 install.vbs 做一些细微更改。
有关方案 1 以及各个脚本的作用的进一步说明,请参见对这些脚本的介绍,网址是:
http://www.microsoft.com/technet/scriptcenter/solutions/appcompat.msxp
Install.vbs 对应于 install.cmd,但增加了一些新功能;install.cmd 是 Application Compatibility Testing and Mitigation Guide for Windows XP Service Pack 2(Windows XP Service Pack 2 应用程序兼容性测试和缓解指南)“附录”中介绍的附带脚本之一。您可以从以下网址下载用来安装该指南及其关联脚本的 Windows Installer (.msi) 文件:
http://www.microsoft.com/downloads/details.aspx?FamilyId=9300BECF-2DEE-4772-ADD9-AD0EAF89C4A7&displaylang=en
要使用此脚本,请复制代码,将代码粘贴到记事本中,然后将脚本另存为 install.vbs。此脚本被设计成了作为 scenario1.vbs 启动的进程的一部分自动运行。
脚本代码
复制代码 代码如下:
'******************************************************************************
'install.vbs
'Author: Peter Costantini, the Microsoft Scripting Guys
'Date: 9/1/04
'Must be deployed to a client and launched remotely by scenario1.vbs.
'Assumes that runonce.vbs is in same directory as script.
'Assumes that Windows XP Service Pack 2 setup program is on a remote server
'and runonce.vbs are in same directory as script.
'1. Runs Service Pack 2 setup program from remote server to install
' Windows XP Service Pack 2. This could take one or two hours.
'2. Configures the AutoAdmin and RunOnce registry settings necessary
' to run runonce.vbs.
'3. Logs results to text file, <computername>-sp2-instlog.txt and copies
' the file back to admin workstation.
'4. Forces a reboot of the local machine so that the AutoAdmin and RunOnce
' registry settings take effect.
'******************************************************************************
On Error Resume Next
'Initialize global constants and variables.
Const FOR_APPENDING = 8
g_strLocalFolder = "c:\temp-ac"
'Change name of computer to actual administrative workstation or local
'path to which log should be copied.
g_strRemoteFolder = "\\<adminwkstn>\c$\temp-ac"
'Get computer name.
g_strComputer = GetComputerName
g_strLogFile = g_strComputer & "-sp2-instlog.txt"
'Create log file.
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextStream = objFSO.OpenTextFile(g_strLogFile, FOR_APPENDING, True)
objTextStream.WriteLine "Windows XP Service Pack 2 " & _
"Installation and Configuration Log: Phase 1"
objTextStream.WriteLine Now
objTextStream.WriteLine g_strComputer
objTextStream.WriteLine String(Len(g_strComputer), "-")
'Handle logic of calling functions and sub-routines to install Service Pack 2
'and configure AutoAdministration.
blnInstallSP = InstallSP
If blnInstallSP = False Then
CopyLog
WScript.Quit
End If
blnAutoAdmin = ConfigAutoAdmin
If blnAutoAdmin = False Then
CopyLog
WScript.Quit
End If
Reboot
'******************************************************************************
Function GetComputerName
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\." _
&"\root\cimv2")
Set colSystems = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem")
For Each objSytem In colSystems
GetComputerName = objSytem.Name
Next
End Function
'******************************************************************************
Function InstallSP
'Edit this line to include the server and share name where the Windows XP
'Service Pack 2 setup program is located.
strInstallPath = "\\servername\xpsp2\WindowsXP-KB835935-SP2-ENU.exe " & _
"/quiet /norestart /o"
Set WshShell = CreateObject("Wscript.Shell")
Set objExec = WshShell.Exec(strInstallPath)
'This could take one or two hours.
objTextStream.WriteLine "Installation started ..."
If Err = 0 Then
'Loop until Exec is finished - Status = 1.
Do While objExec.Status = 0
'Pause for 10 seconds before checking.
'To reduce network traffic, make interval longer.
WScript.Sleep 10000
Loop
objTextStream.WriteLine "Service Pack 2 installation completed."
InstallSP = True
Else
objTextStream.WriteLine "Unable to install Service Pack 2." & VbCrLf & _
"Error connecting to Service Pack 2 on server." & VbCrLf & _
"Error number: " & Err.Number & VbCrLf & _
"Error source: " & Err.Source & VbCrLf & _
"Error description: " & Err.Description
InstallSP = False
End If
Err.Clear
End Function
'******************************************************************************
Function ConfigAutoAdmin
Const HKEY_LOCAL_MACHINE = &H80000002
strKeyPath1 = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
strKeyPath2 = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
strDefaultUserName = "Administrator"
strDefaultPassword = "P@ssw0rd"
strDefaultDomainName = "Contoso"
intAutoAdminLogon = 1
strRunOnceEntry = "MyScript"
strRunoncePath = g_strLocalFolder & "\runonce.vbs"
Set objReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
g_strComputer & "\root\default:StdRegProv")
'Set strDefaultUserName to user with Administrator credentials.
intRet1 = objReg.SetStringValue(HKEY_LOCAL_MACHINE, strKeyPath1, _
"DefaultUserName", strDefaultUserName)
If intRet1 <> 0 Then
objTextStream.WriteLine "Error: DefaultUserName not configured."
End If
'Set strDefaultPassword to password of default username.
intRet2 = objReg.SetStringValue(HKEY_LOCAL_MACHINE, strKeyPath1, _
"DefaultPassword", strDefaultPassword)
If intRet2 <> 0 Then
objTextStream.WriteLine "Error: DefaultPassword not configured."
End If
'Uncomment next 5 lines and edit last parameter if default domain
'for the credentials is different from that already set.
'intRet3 = objReg.SetStringValue(HKEY_LOCAL_MACHINE, strKeyPath1, _
' "DefaultDomainName", strDefaultDomainName)
'If intRet3 <> 0 Then
' objTextStream.WriteLine "Error: DefaultDomainName not configured."
'End If
'Turn on AutoAdminLogon
intRet4 = objReg.SetStringValue(HKEY_LOCAL_MACHINE, strKeyPath1, _
"AutoAdminLogon", "1")
If intRet4 <> 0 Then
objTextStream.WriteLine "Error: AutoAdminLogon not configured."
End If
'Add MyScript entry to RunOnce subkey.
intRet5 = objReg.SetStringValue(HKEY_LOCAL_MACHINE, strKeyPath2, _
strRunOnceEntry, strRunoncePath)
If intRet5 <> 0 Then
objTextStream.WriteLine "Error: MyScript RunOnce entry not configured."
End If
'Check that all registry write operations succeeded.
If (intRet1 + intRet2 + intRet3 + intRet4 + intRet5) = 0 Then
objTextStream.WriteLine "AutoAdminLogon and RunOnce configured."
ConfigAutoAdmin = True
Else
objTextStream.WriteLine "Error: AutoAdminLogon and RunOnce not fully " & _
"configured."
ConfigAutoAdmin = False
End If
End Function
'******************************************************************************
Sub Reboot
Const FORCED_REBOOT = 6
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate," & _
"(Shutdown)}!\\" & g_strComputer & "\root\cimv2")
Set colOSes = objWMIService.ExecQuery("SELECT * FROM Win32_OperatingSystem")
objTextStream.WriteLine "Attempting to reboot ..."
CopyLog
For Each objOS In colOSes 'Only one objOS in collection
intReturn = objOS.Win32Shutdown(FORCED_REBOOT)
If intReturn <> 0 Then
Set objTextStream = objFSO.OpenTextFile(g_strLogFile, FOR_APPENDING, True)
objTextStream.WriteLine Now
objTextStream.WriteLine "Error: Unable to reboot. " & VbCrLf & _
"Return code: " & intReturn
CopyLog
End If
Next
End Sub
'******************************************************************************
Sub CopyLog
'Close text file.
objTextStream.WriteLine "Closing log and attempting to copy file to " & _
"administrative workstation."
objTextStream.WriteLine
objTextStream.WriteLine String(80, "-")
objTextStream.WriteLine
objTextStream.Close
'Copy log.
If Not objFSO.FolderExists(g_strRemoteFolder) Then
objFSO.CreateFolder(g_strRemoteFolder)
If Err <> 0 Then
Err.Clear
Exit Sub
End If
End If
objFSO.CopyFile g_strLogFile, g_strRemoteFolder & "\"
End Sub
要获得在线同行支持,请加入 msnews.microsoft.com 新闻服务器上的 microsoft.public.windows.server.scripting 社区。要提供反馈或报告示例脚本或“脚本指南”中的错误,请联系 Microsoft TechNet。
免责声明
此示例脚本不受任何 Microsoft 标准支持计划或服务的支持。这里仅按原样提供示例脚本,而不作任何类型的担保。Microsoft 进一步明确拒绝所有的暗示担保,包括但不限于对适销性或对特定目的适用性的任何暗示担保。使用或执行示例脚本和文档所引起的全部风险应由您自己承担。在任何情况下,对于使用或不能使用示例脚本或文档所引起的任何损害(包括但不限于商业利润损失、业务中断、商业信息丢失或其他资金损失所造成的损害),Microsoft、其作者以及参与脚本创建、生产或传递的任何其他人员都概不负责,即使 Microsoft 已被告知存在这些损害的可能性。
帝王谷资源网 Design By www.wdxyy.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
帝王谷资源网 Design By www.wdxyy.com
暂无评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。
更新日志
2024年12月22日
2024年12月22日
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]