国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

腳本之家,腳本語言編程技術及教程分享平臺!
分類導航

Python|VBS|Ruby|Lua|perl|VBA|Golang|PowerShell|Erlang|autoit|Dos|bat|

服務器之家 - 腳本之家 - VBS - 可以從一臺遠程服務器運行 SP2 安裝程序Install.vbs

可以從一臺遠程服務器運行 SP2 安裝程序Install.vbs

2020-07-10 18:12VBS教程網 VBS

此腳本由 scenario1.vbs 在一臺網絡主機上啟動。Install.vbs 可以在安裝了 SP2 的主機上以本地方式運行,它執行以下任務: 從一臺遠程服務器運行 SP2 安裝程序

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 已被告知存在這些損害的可能性。

延伸 · 閱讀

精彩推薦
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40
主站蜘蛛池模板: 亚洲一区二区免费视频 | 国产精品99久久 | 午夜激情在线免费观看 | 成人在线免费网站 | 自拍偷拍 国产 | 欧美第一页 | 久久久久久久久久久免费 | 欧美激情在线精品一区二区三区 | 日韩在线观看 | 亚洲精品久久久久久久久久久久久 | 久久婷婷欧美 | 亚洲午夜电影 | 91黄色片 | 亚洲国产成人久久 | 国产精品1区2区 | 福利国产 | 久久久午夜爽爽一区二区三区三州 | 欧美在线免费视频 | 精品日韩一区 | 成人精品视频免费在线观看 | 欧美精品一区二区三区在线播放 | 日本在线免费观看 | 人人九九 | 日韩免费电影 | 国产精品日韩精品 | 国产激情网 | 成人h漫在线观看 | 精品久久一二三区 | 国产精品久久久久久久久久久久久 | 成人av一区二区三区 | 一级毛片免费播放 | 精品一区二区三区免费 | 欧美综合视频 | 久在线视频 | 国产一区自拍视频 | 在线视频一区二区三区 | 91香蕉视频 | 国产视频网| 欧美日韩亚洲国产精品 | 成人3d动漫一区二区三区91 | 国产福利91精品一区二区三区 |