Thursday, December 12, 2019

HP BIOS Update during OS Deployment - MDT

This blog is about how I added BIOS Update in Task Sequence.
Courtesy - https://deploymentbunny.com/2016/07/20/osd-bios-upgrade-during-os-deployment-in-mdtconfigmgr-v3/

The main reason to modify the script is that the amount of different model we have in our production. Even though the majority of them are HP, but it was kept on growing.

The things you need to get it working are listed below.

ModelAliasExit.vbs
InstallBios.ps1
HPBIOS Updates

First Copy the ModelAliasExit.vbs to the script folder in the deployment share. This script is used to detect the Model of the machine.  Please download it from the below location.

https://github.com/DeploymentResearch/DRFiles/blob/master/Scripts/ModelAliasExit.vbs

Once the script is copied, Edit the custom.ini file and add the below lines at the top.

[Settings]
Priority=Default
Properties=NeedReboot,MakeAlias,ModelAlias

After editing the custom.ini file, Copy the below script to notepad and save it as InstallBios.ps1.

#Set BIOS Update File

Function Import-SMSTSENV{
    try
    {
        $tsenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
        Write-Output "$ScriptName - tsenv is $tsenv "
        $MDTIntegration = "YES"
       
        #$tsenv.GetVariables() | % { Write-Output "$ScriptName - $_ = $($tsenv.Value($_))" }
    }
    catch
    {
        Write-Output "$ScriptName - Unable to load Microsoft.SMS.TSEnvironment"
        Write-Output "$ScriptName - Running in standalonemode"
        $MDTIntegration = "NO"
    }
    Finally
    {
    if ($MDTIntegration -eq "YES"){
        $Logpath = $tsenv.Value("LogPath")
        $LogFile = $Logpath + "\" + "$ScriptName.log"

    }
    Else{
        $Logpath = $env:TEMP
        $LogFile = $Logpath + "\" + "$ScriptName.log"
    }
    }
}
Function Start-Logging{
    start-transcript -path $LogFile -Force
}
Function Stop-Logging{
    Stop-Transcript
}
Function Invoke-Exe{
    [CmdletBinding(SupportsShouldProcess=$true)]

    param(
        [parameter(mandatory=$true,position=0)]
        [ValidateNotNullOrEmpty()]
        [string]
        $Executable,

        [parameter(mandatory=$false,position=1)]
        [string]
        $Arguments
    )

    if($Arguments -eq "")
    {
        Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
        $ReturnFromEXE = Start-Process -FilePath $Executable -NoNewWindow -Wait -Passthru
    }else{
        Write-Verbose "Running $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru"
        $ReturnFromEXE = Start-Process -FilePath $Executable -ArgumentList $Arguments -NoNewWindow -Wait -Passthru
    }
    Write-Verbose "Returncode is $($ReturnFromEXE.ExitCode)"
    Return $ReturnFromEXE.ExitCode
}

# Set vars
$SCRIPTDIR = split-path -parent $MyInvocation.MyCommand.Path
$SCRIPTNAME = split-path -leaf $MyInvocation.MyCommand.Path
$SOURCEROOT = "$SCRIPTDIR\Source"
$SettingsFile = $SCRIPTDIR + "\" + $SettingsName
$LANG = (Get-Culture).Name
$OSV = $Null
$ARCHITECTURE = $env:PROCESSOR_ARCHITECTURE


#Try to Import SMSTSEnv
. Import-SMSTSENV

# Set more vars
$Make = $tsenv.Value("Make")
$Model = $tsenv.Value("Model")
$ModelAlias = $tsenv.Value("ModelAlias")
$MakeAlias = $tsenv.Value("MakeAlias")

#Get Bios Info from source folder

$CurrentBiosVersion = Get-Content "$SCRIPTDIR\Source\$Model\BIOSVer.txt"
$BIOSName = Get-Content "$SCRIPTDIR\Source\$Model\BIOSName.txt"

#Start Transcript Logging

. Start-Logging

#Output base info
Write-Output ""
Write-Output "$ScriptName - ScriptDir: $ScriptDir"
Write-Output "$ScriptName - SourceRoot: $SOURCEROOT"
Write-Output "$ScriptName - ScriptName: $ScriptName"
Write-Output "$ScriptName - Current Culture: $LANG"
Write-Output "$ScriptName - Integration with MDT(LTI/ZTI): $MDTIntegration"
Write-Output "$ScriptName - Log: $LogFile"
Write-Output "$ScriptName - Model (win32_computersystem): $((Get-WmiObject Win32_ComputerSystem).model)"
Write-Output "$ScriptName - Name (Win32_ComputerSystemProduct): $((Get-WmiObject Win32_ComputerSystemProduct).Name)"
Write-Output "$ScriptName - Version (Win32_ComputerSystemProduct): $((Get-WmiObject Win32_ComputerSystemProduct).Version)"
Write-Output "$ScriptName - Model (from TSENV): $Model"
Write-Output "$ScriptName - ModelAlias (from TSENV): $ModelAlias"

#Check Model
if($((Get-WmiObject Win32_ComputerSystem).model) -eq $Model){
    Write-Output "Model is $((Get-WmiObject Win32_ComputerSystem).model)"
    Write-Output "Checking BIOS Version"
    Write-Output "Version is $((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion)"
    if($((Get-WmiObject Win32_Bios).SMBIOSBIOSVersion) -ne $CurrentBiosVersion){
        Write-Output "Needs upgrade"
        $Exe = 'HPBIOSUPDREC64.exe'
        $Location = "$SCRIPTDIR\Source\$Model"
        $Executable = $Location + "\" + $exe
        Set-Location -Path $Location
        Invoke-Exe -Executable "$Executable" -Arguments "-s -r -f $BIOSName -b" -Verbose
    }
    else
    {
        Write-Output "No Need to upgrade"
    }
}

#Stop Logging
. Stop-Logging

Next, create an application using InstallBios.ps1.



Make sure the folder structure is correct as per the below picture.
Please download and copy the bios file to the source folder and make sure it the folder name is the same as the machine model name.


Once you copied the necessary BIOS file, you have to create two text files called BIOSName.txt and BIOSVer.txt.

BIOSName.txt file has the name of the BIOS File, and BIOSVer.txt has the BIOS Version






















Next step is to add the application to the task sequence. Make sure you add the task it in the system restore section of the task sequence. I have created a group called 'BIOS Update' and add the application. A computer restart is necessary after the BIOS installation, you can add it in the script or create a computer restart task.



















Update the deployment share and you are ready to run the task sequence.


Saturday, October 26, 2019

Unable to install Optional Windows Features on Windows 10

Right-click on the start button and select run and type "gpedit.msc" to edit your local computer policy. Expand Computer Configuration\AdministrativeTemplates\System

In the system folder, you can see the option "Specify settings for optional component installation and component repair".




Enable the policy and select the checkbox "Download repair content and optional features directly from Windows Update instead of Windows Server Update Services (WSUS)"



You should be able to install the windows features now




Thursday, August 1, 2019

The trust relationship between this workstation and the Primary domain failed on Windows 10

The easy way to fix is to reset the computer account in Active Directory. Most of the time the machine will let you log in after resetting the account in Active Directory
If you can't resolve it by resetting the computer account, then log in to the machine as the local administrator. Remove it from the domain (Join to Workgroup) and rejoin to the domain.

Thursday, June 6, 2019

Adobe Creative Cloud Desktop App stuck on waiting for update(Mac and Windows)

I have seen many forums suggesting uninstall and reinstall all Adobe products or rename the OOBE folder but what worked for me every time is to update the ServiceConfig.xml file.
  • On Mac Machines, Sign out of Adobe CC desktop App
  • Open Activity monitor Stop all Adobe services
  • Open /Library/Application Support/Adobe/OOBE/Configs 
  • Copy the ServiceConfig.xml file to the desktop opens it with text editor then change all the 'false' value to 'true.'  Save the file. 
  • Copy and replace the existing file in  /Library/Application Support/Adobe/OOBE/Configs
  • On Windows machines, the ServiceConfig.xml file is under C:\Program Files (x86)\Common Files\Adobe\OOBE\Configs
  • Copy the file to the desktop, open it with notepad and then change the 'False' value to 'True'.
  • Save the file then copy and replace the existing fil under C:\Program Files (x86)\Common Files\Adobe\OOBE\ Configs\ServiceConfig.xml

Wednesday, June 5, 2019

PXE Boot Aborted : Booting to Next Device

PXE Boot Aborted message might come up when doing OS deployment using PXE.

The main reason could be the machine was already imaged before using SCCM, so try to Clear Required PXE Deployment by right-clicking on the computer name.

If you still get‘PXE Boot aborted’ error message then see if there is any other name for the machine. Sometimes a failed deployment or old deployment leave a different name.




Search the machine name (MININT-SBNED6G) under devices in Configuration Manager and remove it.
You should be able to do PXE boot successfully

Tuesday, April 9, 2019

Error on Domain Controller (0xc00002e2) - Your PC ran into a problem and need to restart


I got the below error on my DC after my VMware workstation crashed. 
 
I have tried safe mode and last known good configuration, and the server restarted to the same blue screen error.  Googled the error and some blogs suggested to remove Active Directory domain services from the DC and reinstall it. Unfortunately, this was my only DC in the lab, and I didn’t have a backup.

Restart the server and select startup settings.


Choose Directory Services Repair Mode from the Advanced options
logged on using the local admin credentials on the DC.  Ran the command prompt as administrator and ran the below command
ntdsutil.exe
activate instance ntds
files
I have received the below error
Could not initialize the Jet engine: Jet Error -501. Failed to open DIT for AD DS/LDS instance NTDS. Error -2147418113
Renamed the .log files located in C:\Windows\ntds and restarted the machine but received the same blue screen with  0xc00002e2 error
Restart the server again in Directory Service Repair mode and ran the command.
esentutl /p "c:\windows\ntds\ntds.dit"
 
 Restarted the server, and the server boots straight into windows.  


Find GPO's applied to a computer if the gpresult /r and rsop.msc failed to load due to permission

How to see the group policies applied to a computer if the gpresult /r and rsop.msc failed to load due to domain permission Run the command ...