Reboot to Normal Mode - Script to be imported as XML file
You will need to upload the following files to your VSASharedFiles:
safemode_reboot_kausrtsk.reg
safemode_reboot_kausrtskwin2k.reg
SafeModeBootAdjust.vbs
SafeModeNormalAdjust.vbs
Contents of - safemode_reboot_kausrtsk.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\KaUsrTsk]
@="Service"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\KaseyaAgent]
@="Service"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\WinVNC4]
@="Service"
Contents of - safemode_reboot_kausrtskwin2k.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\WinSock]
@="Service"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\Winsock2]
@="Service"
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\SafeBoot\Network\WS2IFSL]
@="Service"
Contents of - SafeModeBootAdjust.vbs
'==========================================================================
'
' NAME: SafeModeBootAdjust.vbs
'
' AUTHOR: Nicholas M. Zeigler, PMV Technologies
' COPYRIGHT (c) 2006 All Rights Reserved
' DATE : 9/6/2006
'
'==========================================================================
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("Wscript.Shell")
'Find the System Drive where Boot.Ini will be found
Set env = WshShell.environment("Process")
SysDrive = env.Item("SystemDrive")
BootIni = SysDrive & "\boot.ini"
'Remove file ReadOnly, Hidden, System File state
If objFSO.FileExists(BootIni) Then
WshShell.Run("cmd /c attrib.exe " & BootIni & " -r -h -s")
End If
'Make a backup copy of the boot.ini file
Dim objFSO, objFileCopy
Set objFileCopy = objFSO.GetFile(SysDrive & "\boot.ini")
objFileCopy.Copy (SysDrive & "\bootbackup.ini")
WScript.Sleep 1000
Set oTextStream = objFSO.OpenTextFile(SysDrive & "\bootbackup.ini")
'make an array from the data file
BootIniTxt = Split(oTextStream.ReadAll, vbNewLine)
'OK, Now find where the Windows install is located and add the safe mode line.
For Each line In BootIniTxt
If InStr(1,line,"timeout") Then
timeArray = Split(line,"=")
timeOut = timeArray(0) & "= " & WaitTime
line = timeOut
End If
If InStr(1,line,"Microsoft Windows") Then
lineArray = Split(line,"=")
SafeModeLine = lineArray(0) & "=" & Chr(34) & "Safe Mode" & Chr(34) _
& " /fastdetect /safeboot:network /sos /bootlog /noguiboot"
line = SafeModeLine
End If
If InStr(1,line,"Windows Server") Then
lineArray = Split(line,"=")
SafeModeLine = lineArray(0) & "=" & Chr(34) & "Safe Mode" & Chr(34) _
& " /fastdetect /safeboot:network /sos /bootlog /noguiboot"
line = SafeModeLine
End If
Report = Report & line & vbCrLf
Next
'Open Boot.ini for writing and write new text
Set ts = objFSO.OpenTextFile (BootIni, ForWriting)
ts.write Report
ts.close
WScript.Sleep 300
LockFile
Sub LockFile
'Return file to previous ReadOnly, Hidden, System File state
If objFSO.FileExists(BootIni) Then
WshShell.Run("cmd /c attrib.exe " & BootIni & " +r +h +s")
End If
End Sub
Contents of - SafeModeNormalAdjust.vbs
'==========================================================================
'
' NAME: SafeModeNormalAdjust.vbs
'
' AUTHOR: Nicholas M. Zeigler, PMV Technologies
' COPYRIGHT (c) 2006 All Rights Reserved
' DATE : 9/7/2006
'
'==========================================================================
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set WshShell = CreateObject("Wscript.Shell")
'Find the System Drive where Boot.Ini will be found
Set env = WshShell.environment("Process")
SysDrive = env.Item("SystemDrive")
BootIni = SysDrive & "\boot.ini"
'Remove file ReadOnly, Hidden, System File state
If objFSO.FileExists(BootIni) Then
WshShell.Run("cmd /c attrib.exe " & BootIni & " -r -h -s")
End If
'Delete temp boot.ini and rename original boot.ini
WScript.Sleep 1000
objFSO.DeleteFile BootIni
objFSO.MoveFile SysDrive & "\bootbackup.ini" , BootIni
'Return file to previous ReadOnly, Hidden, System File state
If objFSO.FileExists(BootIni) Then
WshShell.Run("cmd /c attrib.exe " & BootIni & " +r +h +s")
End If