Jump to content


Leaderboard

Popular Content

Showing content with the highest reputation on 04/17/2019 in all areas

  1. Fix for bootloops when a TS is initiated from Software Center and the script is detecting failures during the checks. Change Sub Reboot Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "wpeutil reboot" End Sub To Sub Reboot Set objFSO2 = CreateObject("Scripting.FileSystemObject") Set colDrives = objFSO2.Drives For Each objDrive in colDrives if objDrive.DriveType=2 then SMSTSDrive=objFSO2.FolderExists(objDrive.DriveLetter + ":\_SMSTaskSequence") if SMSTSDrive then BootDrive=objDrive.DriveLetter&":\" end if end if Next Set WshShell = WScript.CreateObject("WScript.Shell") PEFirmware="HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PEFirmwareType" PeBoot = "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\PEBootType" FirmwareType=WshShell.RegRead(PEFirmware) BootType=WshShell.RegRead(PeBoot) If lcase(BootType)="ramdisk:sourceidentified" then If FirmwareType=2 then BCD=BootDrive&"_SMSTaskSequence\BCD-EFI\BCD" else BCD=BootDrive&"_SMSTaskSequence\backup\boot\BCD" end if WshShell.Run("bcdedit /import " & BCD & " /clean"),1,true wscript.sleep(2000) end if WshShell.Run "wpeutil reboot" End Sub This will also cause the TS to continue in the full OS. If you want to prevent that add something like this after the first reboot. (Since checkfornetwork.vbs shouldn't fail if it succeeded the first time) Side note. The start cmd part is good but it's a LPE-exploit waiting to happen. All you have to do is start a TS from SC and then pull the cable and you're 'local system'. Don't bind it to cancel since the x in the corner returns the same thing. Detect if "command support" is enabled on the boot image and only give the choice to start a cmd.exe if so. Add the last 2 lines accordingly. ' updated 2015/4/26 logging folder creation fix ' On Error Resume Next DIM objShell, WshNetwork, sPingTarget, iNumberofFails, iFailureLimit, LogFileName, logfile, objFSO, objFile, outFile, CheckPartitions Set WshNetwork = WScript.CreateObject("WScript.Network") Set objShell = WScript.CreateObject( "WScript.Shell" ) sysDrv=objShell.ExpandEnvironmentStrings( "%SYSTEMDRIVE%" ) Buttons=vbOKOnly And this. function isDebug() FoundINI=objFSO.FileExists(sysdrv+"\Windows\System32\winpeshl.ini") If (FoundINI=vbTrue) then 'wscript.echo Cstr(bExists) & " " & bExists Set file = objFSO.OpenTextFile (sysdrv+"\Windows\System32\winpeshl.ini", 1, vbFalse, -1) row = 0 Do Until file.AtEndOfStream line = file.Readline 'WScript.Echo lcase(line) If (instr(lcase(line),"tsbootshell.exe")<>0) then TsBootShell=replace(lcase(line),"tsbootshell.exe","tsbootshell.ini") 'Wscript.echo TsBootShell TsINI=objFSO.FileExists(objShell.ExpandEnvironmentStrings(TsBootShell)) If (TsINI=vbTrue) then Set ReadTsINI = objFSO.OpenTextFile (objShell.ExpandEnvironmentStrings(TsBootShell), 1, vbFalse, -1) strTSINItext=ReadTsINI.readall If (instr(lcase(strTSINItext),lcase("EnableDebugShell=true"))<>0) then 'WScript.Echo "DebugMode" Buttons=vbYESNO end if ReadTsINI.Close end if end if row = row + 1 Loop file.Close end if end function Add a 'If' on the buttons shown and that's been taken care of as well. E.g. if (Buttons=vbOKOnly) then Message="Kunde inte hitta en hårddisk att installera Windows på." & vbCrLf & vbCrLf & " Meddela IT att detta kan vara orsaken:" & vbCrLf & vbCrLf & "* Saknar drivrutiner för hårddisken . " & vbCrLf & "* Hårddisken kan vara trasig. " & vbCrLf & vbCrLf & "Hårdvara: " & vbCrLf & vbCrLf & SataResult &"Dator: "& MakeModel & vbCrLf & vbCrLf & "Tryck [OK] när du är klar." Else Message="Kunde inte hitta en hårddisk att installera Windows på." & vbCrLf & vbCrLf & " Meddela IT att detta kan vara orsaken:" & vbCrLf & vbCrLf & "* Saknar drivrutiner för hårddisken . " & vbCrLf & "* Hårddisken kan vara trasig. " & vbCrLf & vbCrLf & "Hårdvara: " & vbCrLf & vbCrLf & SataResult &"Dator: "& MakeModel & vbCrLf & vbCrLf & "Tryck [YES] för att få installationen att misslyckas eller [NO] för att starta en CMD-prompt." end if result=MsgBox (Message, Buttons, "Warning: Unable to continue") 'result = MsgBox ("Unable to find a valid internal storage device." & vbCrLf & vbCrLf & "Possible causes can be: " & vbCrLf & vbCrLf & "* Missing Storage drivers. " & vbCrLf & "* Missing HDD/SSD. " & vbCrLf & vbCrLf & "Please inform the person supporting you that the following hardware was detected: " & vbCrLf & vbCrLf & SataResult &"Computer: "& MakeModel & vbCrLf & vbCrLf & "Press [OK] to exit and reboot or press [Cancel] to open a CMD prompt to troubleshoot further."_ ', vbOKCancel, "Warning: Unable to continue") Select Case result Case vbOK Set objShell = Nothing 'objShell.Run("x:\windows\system32\winpeshl.exe"),1,true Reboot Case vbNo Set objShell = WScript.CreateObject( "WScript.Shell" ) objShell.Run("cmd.exe /s") msgbox "When you are finished, press [OK]" Reboot End Select Edit: And of course calling the function early in the script.
    1 point
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.