none
WorkFlow reboot help RRS feed

  • Question

  • First and for most, scripting of any language is not something I do on a daily, weekly or monthly basis. I build PS, BAT and VBS on an as-needed. I manage and handle too many other roles to have spare time to learn scripting in whole. That being said, Yes I know my script is sloppy and yes I'm sure there's another smoother, cleaner, refined way of writing. However, I'm only focusing on one particular function to finish my PS script.

    The script below is to be ran on any device in our company that is not currently Windows 10 and the bios is in a legacy state.  The tasks the script preforms is:

    Task 1: Identify Model and Bios Version
    Task 2: Upgrades bios if said bios is less than stated version, reboot computer and resume to next task
    Task 3: Install Dell CCTK
    Task 4: Configure Bios and enable TPM
    Task 5: Launch MDT Litetouch to image computer

    All tasks were tested individually, verified and passed. However, when I added WorkFlow it broke Task 2. Task 2 no longer searches for the model or bios version and does not install the newer bios version. Essentially, Task 2 is skipped and it moves on to Task 3.

    Can someone help me understand WorkFlow and how it needs to be written so that after the reboot the script can pick back up and finish tasks 3, 4 and 5, please?

    set-executionpolicy -executionpolicy bypass -force
    ## Task 1: Identify Model and Bios Version ##
    $ComputerModel = (Get-WmiObject Win32_ComputerSystem).Model
    $BIOSVersion = (Get-WmiObject Win32_BIOS).SMBIOSBIOSVersion
    
    ## Task 2: Upgrades bios if said bios is less than stated version, reboot computer and resume to next task ##
    WorkFlow Upgrade-Bios
    {
        Parallel {
        }
        if (($ComputerModel -eq 'Latitude 7490') -and ($BIOSVersion -le '1.9.3')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\L7x90\Latitude7x90.exe /s /bls
        }
        if (($ComputerModel -eq 'Latitude 7390') -and ($BIOSVersion -le '1.9.3')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\L7x90\Latitude7x90.exe /s /bls
        }
        if (($ComputerModel -eq 'Latitude 7280') -and ($BIOSVersion -le '1.14.1')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\L7x80\Latitude7x80.exe /s 
        }
        if (($ComputerModel -eq 'Latitude 5490') -and ($BIOSVersion -le '1.8.3')) {
           \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\L5x90\Latitude5X90.exe /s 
        }
        if (($ComputerModel -eq 'Latitude 5480') -and ($BIOSVersion -le '1.14.2')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\L5x80\Latitude5X80.exe /s 
        }
        if (($ComputerModel -eq 'Latitude E7440') -and ($BIOSVersion -le 'A27')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\LE7440\E7440A27.exe /s 
        }
        if (($ComputerModel -eq 'Latitude E6430') -and ($BIOSVersion -le 'A23')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\LE6430\E6430A23.exe /s 
        }
        if (($ComputerModel -eq 'Latitude E5470') -and ($BIOSVersion -le '1.19.3')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\O7020\O7020A17.exe /s 
        }
        if (($ComputerModel -eq 'Latitude E5450') -and ($BIOSVersion -le 'A20')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\LE7440\E7440A27.exe /s 
        }
        if (($ComputerModel -eq 'Latitude E5440') -and ($BIOSVersion -le 'A20')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\LE7440\E7440A27.exe /s 
        }
        if (($ComputerModel -eq 'OptiPlex 7060') -and ($BIOSVersion -le '1.3.4')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\O7060\OptiPlex7060.exe /s 
        }
        if (($ComputerModel -eq 'OptiPlex 7050') -and ($BIOSVersion -le 'A24')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\O7050\OptiPlex7050.exe /s 
        }
        if (($ComputerModel -eq 'OptiPlex 7040') -and ($BIOSVersion -le '1.14.0')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\O7040\OptiPlex7040.exe /s 
        }
        if (($ComputerModel -eq 'OptiPlex 7020') -and ($BIOSVersion -le 'A17')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\O7020\O7020A17.exe /s 
        }
        if (($ComputerModel -eq 'OptiPlex 9020') -and ($BIOSVersion -le 'A24')) {
            \\ThatsWhatSheSaid.com\storage\Software\Dell\BIOS\O9020\O9020A24.exe /s 
        }
        Restart-Computer -Wait
    }
       
    ## Task 3: Install Dell CCTK ##
    msiexec.exe /i "\\ThatsWhatSheSaid.com\storage\Software\Dell\CCTK\cctk4.1.msi" /qn
    
    ## Task 4: Configure Bios and enable TPM ## 
    cmd.exe /k "C:\Program Files\Dell\Command Configure\X86\cctk.exe" BootOrder --ActiveBootList=uefi --AcPwrRcvry=Last BootOrder --ActiveBootList=uefi --AdminSetupLockout=Disabled --Aspm=Auto --Asset= --AutoOn=Disabled --AutoOnHr=0 --AutoOnMn=0 --BlockSleep=Disabled --ChasIntrusion=SilentEnable --CpuCores=All --CpuXdSupport=Enabled --CStatesCtrl=Enabled --DeepSleepCtrl=S4AndS5 --EmbNic1=EnabledPxe --EmbSataRaid=Raid --FanCtrlOvrd=Disabled --HddProtection=Disabled --IntegratedAudio=Enabled --IntelRapidStart=Disabled --IntlSmartConnect=Disabled --IrstTimer=30 --LegacyOrom=Disabled --LimitCpuidValue=Disabled --LogicProc=Disabled --NumLock=Enabled --OromKeyboardAccess=Enabled --PasswordBypass=Disabled --PasswordLock=Disabled --PostMebxKey=Enabled --PropOwnTag=  --RptKeyErr=Enabled --Sata0=Enabled --Sata1=Enabled --Sata2=Enabled --Serial1=Com1 --Serr=Enabled --SmartErrors=Disabled --Speedstep=Enabled --StrongPassword=Disabled --TpmSecurity=Enabled --TrustExecution=Disabled --TurboMode=Enabled --UefiNwStack=Enabled --Usb30=Enabled --UsbEmu=Enabled --UsbPortsFront=Enabled --UsbPortsFront30=Enabled --UsbPortsRear30=Enabled --UsbRearDual=Enabled --UsbRearDual2Stack=Enabled --UsbWake=Enabled --Virtualization=Enabled --VtForDirectIo=Enabled --WakeOnLan=Enable
    cmd.exe /k "C:\Program Files\Dell\Command Configure\X86\cctk.exe" --SetupPwd=NY/NJ/CA=Garbage
    cmd.exe /k "C:\Program Files\Dell\Command Configure\X86\cctk.exe" --tpm=on --valsetuppwd=NY/NJ/CA=Garbage
    cmd.exe /k "C:\Program Files\Dell\Command Configure\X86\cctk.exe" --tpmactivation=activate --valsetuppwd=NY/NJ/CA=Garbage
    cmd.exe /k "C:\Program Files\Dell\Command Configure\X86\cctk.exe" --setuppwd= --valsetuppwd=NY/NJ/CA=Garbage
    cmd.exe /k "C:\Program Files\Dell\Command Configure\X86\cctk.exe" --TpmPpiAcpi=Enabled
    cmd.exe /k "C:\Program Files\Dell\Command Configure\X86\cctk.exe" --TpmPpiAcpi=Enabled
    cmd.exe /k "C:\Program Files\Dell\Command Configure\X86\cctk.exe" --TpmPpiPo=Enabled
    cmd.exe /k "C:\Program Files\Dell\Command Configure\X86\cctk.exe" --TpmPpiDpo=Enabled
    
    ## Task 5: Launch MDT Litetouch to image computer ##
    cscript.exe \\ThatsWhatSheSaid.com\storage\mdt\Deployments\Production\Scripts\Litetouch.vbs
    pause>nul

    Wednesday, June 5, 2019 2:10 PM