我们用来输入计算机名称的VBScript配置在Windows 7中运行良好的新系统似乎在Windows 10中没有做任何事情。我是否可以进行任何更改以允许它在Windows 10中运行?
Function NewPrep
Set xmlDoc = CreateObject("Microsoft.XMLDOM")
xmlDoc.Load("C:\Users\ECSUser\AppData\Local\Marlin\ECSConfiguration.xml")
Set nNode = xmlDoc.SelectSingleNode("//NewDataSet/GlobalSettings/SerialNum")
nNode.Text = ""
Do While nNode.Text = ""
nNode.Text = InputBox("Enter the ECS PC Serial Number:", "ECSNewPrep")
Loop
strResult = xmldoc.Save("C:\Users\ECSUser\AppData\Local\Marlin\ECSConfiguration.xml")
Do While Name = ""
Name = InputBox("Enter the Computer Name:", "ECSNewPrep")
Loop
Set objWMIService = GetObject("Winmgmts:root\cimv2")
For Each objComputer In objWMIService.InstancesOf("Win32_ComputerSystem")
Return = objComputer.Rename(Name)
Next
If intCellular = vbYes Then
'Cellular - Commented out 6/18/2015 - MB
AV
End If
If intAV = vbYes Then
AV
End If
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_USERS = &H80000003
strComputer = "."
Set Stdout = WScript.StdOut
Set oReg = GetObject ("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
oReg.SetStringValue HKEY_CURRENT_USER, "AppEvents\Schemes", strValueName, ".None"
oReg.SetStringValue HKEY_USERS, ".Default\Control Panel\Keyboard", "InitialKeyboardIndicators", 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
If (objFSO.FolderExists("C:\ECS\AV")) Then
objFSO.DeleteFolder "C:\ECS\AV"
End If
Set objFSO = Nothing
Set objShell = CreateObject("Wscript.Shell")
sRegFile = "C:\Windows\system32\postsysprep.reg"
objShell.Run "regedt32.exe /s""sRegFile""", 0, True
objShell.Run "CMD /c netsh advfirewall firewall add rule name=""ECSManager"" dir=in action=allow program=""c:\ecs\ecsmanager\csmanager.exe"" enable=yes"
objShell.Run "CMD /c netsh advfirewall firewall add rule name=""ECSAlert"" dir=in action=allow program=""c:\ecs\ecsAlert\ecsAlert.exe"" enable=yes"
objShell.Run "CMD /c netsh advfirewall firewall add rule name=""ECSMonitor"" dir=in action=allow program=""C:\ECS\ECSMonitor\ECSMonitor.exe"" enable=yes"
objShell.Run "CMD /c netsh advfirewall firewall add rule name=""ECSSoftwareAutoUpdater"" dir=in action=allow program=""c:\ecs\ecssoftwareautoupdater\ecssoftwareautoupdater.exe"" enable=yes"
objShell.Run "CMD /c netsh advfirewall firewall add rule name=""ECSConfig"" dir=in action=allow protocol=TCP localport=11337"
objShell.Run "CMD /c netsh advfirewall firewall add rule name=""ICMP Allow incoming V4 echo request"" protocol=icmpv4:8,any dir=in action=allow"
objShell.Run "CMD /c netsh advfirewall firewall set rule group=""remote desktop"" new enable=Yes"
objShell.Run "CMD /c netsh advfirewall firewall set rule group=""remote administration"" new enable=yes"
objShell.Run "CMD /c powercfg -setactive 7dba7c8d-b82a-4f3e-9bd3-25ef4c6369ca"
objShell.Run "NET USER administrator /active:yes"
objShell.Run "C:\Windows\System32\slmgr.vbs /ato", 0, True
objShell.Run "control.exe TimeDate.cpl"
set objAutoUpdate = CreateObject("Microsoft.Update.AutoUpdate")
set objSettings = objAutoUpdate.Settings
objSettings.NotificationLevel = 4
objSettings.Save
MsgBox "PC will now reboot", , "ECSNewPrep"
objShell.Run "shutdown -r -t 00"
End Function
Function Cellular
strComputer = "."
Do While strValue = ""
strValue = InputBox("Enter the Cellular MAC:", "ECSNewPrep")
Loop
Set Stdout = WScript.StdOut
Set oReg = GetObject ("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0010", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0011", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0024", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0013", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0014", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0015", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0016", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0017", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0018", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0019", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0020", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0021", "NetworkAddress", strValue
oReg.SetStringValue HKEY_LOCAL_MACHINE, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\0022", "NetworkAddress", strValue
MsgBox "Adding MAC To Registry", , "ECSNewPrep"
End Function
Function AV
Set objFSO = CREATEOBJECT("Scripting.FileSystemObject")
If (objFSO.FolderExists("C:\ECS\AV")) Then
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strcomputer & "\root\cimv2")
objWMIService.Create "C:\ecs\AV\Setup.exe", null, null, intProcessID
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colMonitoredProcesses = objWMIService.ExecNotificationQuery _
("Select * From __InstanceDeletionEvent Within 1 Where TargetInstance ISA 'Win32_Process'")
Do Until i = 1
Set objLatestProcess = colMonitoredProcesses.NextEvent
If objLatestProcess.TargetInstance.ProcessID = intProcessID Then
i = 1
End If
Loop
Else
MsgBox "AV Installer Missing from C:\ECS\AV", , "ECSNewPrep"
End If
End Function
intCellular = MsgBox("Is this PC for a Cellular Install?", vbYesNo, "ECSNewPrep")
If intCellular = vbNo Then
intAV = MsgBox("Does this PC require AV?", vbYesNo, "ECSNewPrep")
End If
NewPrep