4.5 C
New York
Sunday, January 14, 2024

{Hardware} Assist Apps with out the Microsoft Retailer


(Contributor:  Thad Lawson)

Introduction

With variations of Home windows 10 since 1809, Microsoft has launched the idea of Trendy Drivers.  These new drivers have a couple of necessities:

  1. Declarative:  The motive force have to be INF installable with no co-installers
  2. Componentized:  The motive force should help the structure of getting a base driver with optionally available extension drivers for customizations above the bottom performance
  3. {Hardware} Assist Apps:  Any software program required for working with the system have to be within the type of a UWP app out there from the Microsoft Retailer and will probably be related to this driver within the INF.

One intent of this stuff is to simplify in-place upgrades.  With this method, if a Home windows 10 system is upgraded to a brand new construct by Home windows Replace and any new drivers are required, Home windows Replace can set up the driving force and it will possibly set off the software program to be put in mechanically from the Microsoft Retailer.

However what occurs if in case you have blocked entry to the Microsoft Retailer?  You’ll find yourself with a driver put in for a part with out the software program to manage the system.  Take into account that not all system drivers would require a software program part.  Nonetheless, for people who do you could want them to get the total person expertise out of your system.

So how do you deploy these {Hardware} Assist Apps (HSAs) with out utilizing the Microsoft Retailer?  That is the place Lenovo’s {Hardware} Assist App Packs are available in.

Beginning in late June of 2020 you’ll start to see these present up on the Lenovo Assist website on the Drivers & Software program web page for the particular mannequin, underneath the Enterprise Administration part.  These will probably be out there for the brand new merchandise simply launched and going ahead.  The HSA Packs are much like our SCCM Driver Packs.  They include simply the supply information to put in the apps for particular fashions.  One distinction between the 2 is that the HSA Packs will sometimes should be up to date a lot much less steadily.  With this structure, the driving force could change a number of occasions and proceed to make use of the identical HSA.

The HSA Pack will probably be a self-extracting executable file like our SCCM Driver Packs.  While you extract one you’ll get a folder construction with every app’s supply information contained in their very own folder.  By default a folder with a random title will probably be used to stop any form of symlink vulnerability.

Scripted Set up of {Hardware} Assist Apps throughout a Job Sequence

We have now created a script to learn JSON manifest information supplied within the HSA packs.  The script will be leveraged in MEM/SCCM or MDT.  Beneath is the PowerShell script you should utilize for set up.

################################################################################
##                                                                            ##
##      Title: Set up-HSA.ps1                                                ##
##  Writer: Lenovo                                                         ##
##    Model: 1.02                                                           ##
##       Date: 2020-06-03                                                     ##
##                                                                            ##
##                              Authorized Disclaimer                              ##
##                                                                            ##
##  The pattern scripts should not supported underneath any Lenovo commonplace help    ##
##  program or service. The pattern scripts are supplied AS IS with out         ##
##  guarantee of any variety. Lenovo additional disclaims all implied warranties     ##
##  together with, with out limitation, any implied warranties of                  ##
##  merchantability or of health for a specific function. Your complete danger   ##
##  arising out of the use or efficiency of the pattern scripts and           ##
##  documentation stays with you. In no occasion shall Lenovo, its authors,    ##
##  or anybody else concerned within the creation, manufacturing, or supply of the   ##
##  scripts be accountable for any damages by any means (together with, with out          ##
##  limitation, damages for lack of enterprise income, enterprise                ##
##  interruption, lack of enterprise data, or different pecuniary loss)      ##
##  arising out of using or incapacity to make use of the pattern scripts or       ##
##  documentation, even when Lenovo has been suggested of the potential of      ##
##  such damages.                                                             ##
##                                                                            ##
################################################################################


<#
.SYNOPSIS

    Record the names of or set up {Hardware} Assist Functions (HSA) by 
    studying manifest information positioned within the subdirectories.

.DESCRIPTION

    By studying manifest information discovered within the subdirectories of a {Hardware} Assist 
    Functions Pack, this script permits for the deployment of 1, many, or 
    all {Hardware} Assist Functions for a given mannequin.  All installations are 
    towards an offline set up of Home windows 10.

.PARAMETER LIST

    Used to record the names of all {Hardware} Assist Functions within the 
    subdirectories.  Returns the record of the {Hardware} Assist 
    Functions names to the display screen.

    -LIST

.PARAMETER EXPORT

    Used to record the names of all {Hardware} Assist Functions within the 
    subdirectories.  Returns the record of names to the Export_<Date><Time>.log 
    file within the listing from which the script was executed.

    -LIST -EXPORT

.PARAMETER OFFLINE

    Used to put in the {Hardware} Assist Functions.

    -OFFLINE <-ALL, FILE '<FileName>.txt', or -NAME '<HSA Title>'>

.PARAMETER ALL

    Used to put in all {Hardware} Assist Functions within the subdirectories 
    beneath the script.

    -OFFLINE -ALL

.PARAMETER FILE

    Used to put in a listing of {Hardware} Assist Functions.  The textual content file 
    needs to be formatted with one {Hardware} Assist Software title per line.  
    The file ought to reside in the identical folder because the Set up-HSA.ps1 script.  
    The names will be discovered utilizing the -LIST parameter.  

    -OFFLINE -FILE '<FileName>.txt'

.PARAMETER NAME

    Used to put in one {Hardware} Assist Software.  The title will be discovered 
    utilizing the -LIST parameter.

    -OFFLINE -NAME '<HSA Title>'

.PARAMETER NOSMSTS

    Used when operating in WinPE, however not in a Microsoft.SMS.TSEnvironment, 
    supplied by Microsoft Endpoint Supervisor (MEM), System Middle 
    Configuration Supervisor (SCCM), or Microsoft Deployment Toolkit (MDT).

    Name this parameter with the drive letter the place the Home windows partition has 
    the Home windows folder already put in.

    -NOSMSTS '<Drive Letter>:'

.PARAMETER DEBUGINFORMATION

    Use to activate Transcript logging and full logging of DISM Instructions.  The 
    transcript file will be discovered at C:WindowsLogs.  There will probably be a separate 
    log file from every DISM command generated at C:WindowsLogsDISM.

    -DEBUGINFORMATION

.EXAMPLE

    .Set up-HSA.ps1 -LIST

.EXAMPLE

    .Set up-HSA.ps1 -LIST -EXPORT

.EXAMPLE

    .Set up-HSA.ps1 -OFFLINE -NAME 'Lenovo Pen Settings'

.EXAMPLE

    .Set up-HSA.ps1 -OFFLINE -FILE 'Record.txt'

.EXAMPLE

    .Set up-HSA.ps1 -OFFLINE -NOSMSTS 'D:' -ALL

.EXAMPLE

    .Set up-HSA.ps1 -OFFLINE -NOSMSTS 'D:' -ALL -DEBUGINFORMATION

.NOTES

    Return Code 1 = Each the -LIST and -OFFLINE instructions had been used.  Just one 
                    of those two parameters can be utilized at a time.
    Return Code 2 = Multiple -ALL, -FILE, or -NAME had been used.  Just one 
                    of those three parameters can be utilized at a time.
    Return Code 3 = No *_HSA_Manifest.json information had been discovered within the 
                    subdirectories.
    Return Code 4 = When utilizing the -FILE parameter, the file title was not 
                    discovered within the listing the place the script resides.

#>

#######################
#  SCRIPT PARAMETERS  #
#######################
[CmdletBinding(DefaultParameterSetName = 'GetList')]
Param(
    [Parameter(ParameterSetName = 'GetList')]
    [switch]$Record,
    [Parameter(ParameterSetName = 'GetList')]
    [switch]$Export,
    [Parameter(ParameterSetName = 'InstallOffline')]
    [switch]$Offline,
    [Parameter(ParameterSetName = 'InstallOffline')]
    [ValidateNotNullOrEmpty()]
    [string]$Title,
    [Parameter(ParameterSetName = 'InstallOffline')]
    [ValidateNotNullOrEmpty()]
    [string]$File,
    [Parameter(ParameterSetName = 'InstallOffline')]
    [switch]$All,
    [Parameter(ParameterSetName = 'InstallOffline')]
    [ValidateNotNullOrEmpty()]
    [string]$NoSMSTS,
    [Parameter(ParameterSetName = 'GetList')]
    [Parameter(ParameterSetName = 'InstallOffline')]
    [switch]$DebugInformation
)
###############
#  FUNCTIONS  #
###############
#Set up-HSA
Operate Set up-HSA
{
    [CmdletBinding()]
    param (
        [PSCustomObject]$HSAPackage,
        [String]$HSAName
    )
    $OutDep = $Null
    If((($HSAName -contains $HSAPackage.hsa) -and ($Null -ne $HSAName))-or $All)
    {
        ForEach($Dep in $HSAPackage.Dependencies)
        {
            $OutDep += " /DependencyPackagePath:`"$($HSAPackage.JSONPath)$($Dep)`""
        }
        $DISMLog = ""
        If($DebugInformation)
        {
            If(!(Take a look at-Path -Path "$($LogPath)DISM"))
            {
                New-Merchandise -Path "$($LogPath)DISM" -ItemType Listing
            }
            $DISMLog = " /LogLevel:4 /LogPath:`"$LogPathDISM$($HSAPackage.hsa).log`""
        }
        $DISMArgs = "/Add-ProvisionedAppxPackage /PackagePath:`"$($HSAPackage.JSONPath)$($HSAPackage.appx)`" /LicensePath:`"$($HSAPackage.JSONPath)$($HSAPackage.license)`"$($OutDep) /Area:`"All`"$DISMLog"
        Write-Host "Offline DISM - $($HSAPackage.hsa)"
        If($NoSMSTSPresent)
        {
            Write-Host "Utilizing string knowledge from NoSMSTS parameter to outline the basis drive letter for the DISM /Picture parameter."
        }
        $DISMArgs = "/Picture:$($Drive) $($DISMArgs)"
        Write-Host "$env:windirsystem32Dism.exe $DISMArgs"
        Begin-Course of -FilePath "$env:windirsystem32Dism.exe" -ArgumentList $DISMArgs -Wait
    }
}
##################
#  SCRIPT SETUP  #
##################
$FilePresent = $false
$NamePresent = $false
$NoSMSTSPresent = $false
If(($PSBoundParameters.ContainsKey('Record') -and $PSBoundParameters.ContainsKey('Offline')))
{
    Write-Host "Use only one from the next record of parameters: -Record or -Offline.  Overview the script utilization data for utilizing these parameters."
    Return 1
}
If($Offline)
{
    If(($PSBoundParameters.ContainsKey('All') -and $PSBoundParameters.ContainsKey('File') -and $PSBoundParameters.ContainsKey('Title')) -or ($PSBoundParameters.ContainsKey('All') -and $PSBoundParameters.ContainsKey('File')) -or ($PSBoundParameters.ContainsKey('All') -and $PSBoundParameters.ContainsKey('Title')) -or ($PSBoundParameters.ContainsKey('File') -and $PSBoundParameters.ContainsKey('Title')) -or ((!($PSBoundParameters.ContainsKey('All')) -and (!($PSBoundParameters.ContainsKey('File'))) -and (!($PSBoundParameters.ContainsKey('Title'))))))
    {
        Write-Host "Use only one from the next record of parameters: -All, -Title, or -File.  Overview the script utilization data for utilizing these parameters."
        Return 2
    }
    ElseIf($PSBoundParameters.ContainsKey('File'))
    {
        $FilePresent = $true
    }
    ElseIf($PSBoundParameters.ContainsKey('Title'))
    {
        $NamePresent = $true
    }
}
If($PSBoundParameters.ContainsKey('NoSMSTS'))
{
    $NoSMSTSPresent = $true
}
#Setup Vars
$ScriptDir = Cut up-Path $Script:MyInvocation.MyCommand.Path
If(($Offline) -and (!($NoSMSTSPresent)))
{
    $TSenv = New-Object -COMObject Microsoft.SMS.TSEnvironment
    If($TSEnv.worth("OSDTargetSystemDrive") -ne "")
    {
        $Drive = "$($TSEnv.worth("OSDTargetSystemDrive"))"
    }
    Else
    {
        $Drive = "$($TSEnv.worth("OSDisk"))"
    }
}
ElseIf(($Offline) -and ($NoSMSTSPresent))
{
    $Drive = $NoSMSTS
}
ElseIf($Record)
{
    $Drive = $env:SystemDrive
}
$LogDate = Get-Date -Format yyyyMMddHHmmss
If($DebugInformation)
{
    $LogPath = "$($Drive)WindowsLogs"
    $LogFile = "$LogPath$($myInvocation.MyCommand)_$($LogDate).log"

######################
#  START TRANSCRIPT  #
######################
    Begin-Transcript $LogFile -Append -NoClobber
    Write-Host "Debug enabled"
}
##########
#  MAIN  #
##########
$MFJs = Get-ChildItem -path $ScriptDir -Recurse -File -Embody "*_manifest.json"
If($Null -eq $MFJs)
{
    Write-Host "No HSA_Manifest.JSON information discovered within the subfolder construction."
    Return 3
}
Else
{
    $HSAPackages = @()
    ForEach($MFJ in $MFJs)
    {
        $MFJData = Get-Content material -Path "$($MFJ.FullName)" | ConvertFrom-Json
        $HSAPackages += New-Object PSObject -Property @{'JSONPath' = $MFJ.DirectoryName; 'HSA' = $MFJData.HSA; 'Appx' = $MFJData.Appx; 'License' = $MFJData.License; 'Dependencies' = $MFJData.Dependencies}
    }
}
If($Record -or $PSBoundParameters.Depend -eq 0 -or ($DebugInformation -and $PSBoundParameters.Depend -eq 1))
{
    If($PSBoundParameters.ContainsKey('Export'))
    {
        ForEach($Bundle in $HSAPackages)
         Out-File "$ScriptDirExport_$LogDate.txt" -Append -Noclobber
        
    }
    Else
    {
        ForEach($Bundle in $HSAPackages)
        {
            Write-Host $Bundle.hsa
        }
    }
}
If($Offline)
{
    If($All)
    {
        Write-Host "Putting in all HSAs discovered within the folder construction."
    }
    ElseIf($NamePresent)
    {
        Write-Host "Putting in the $Title HSA."
    }
    ElseIf($FilePresent)
    {
        Write-Host "Studying the record of HSAs from $File."
        If(!(Take a look at-Path -Path "$ScriptDir$File"))
        {
            Write-Host "File: $File not present in $ScriptDir"
            Return 4
        }
    }
    ForEach($Bundle in $HSAPackages)
    {
        If($All)
        {
            Set up-HSA -HSAPackage $Bundle
        }
        ElseIf($FilePresent -or $NamePresent)
        { 
            If($FilePresent)
            {
                $InstallFileArray = @()
                $InstallFileArray = Get-Content material -Path "$ScriptDir$File"
                ForEach($InstallFile in $InstallFileArray)
                {
                    Set up-HSA -HSAPackage $Bundle -HSAName $InstallFile
                }
            }
            If($NamePresent)
            {
                Set up-HSA -HSAPackage $Bundle -HSAName $Title
            }
        }
        $InstallFileArray = $Null
    }
}
If($DebugInformation)
{
    #####################
    #  STOP TRANSCRIPT  #
    #####################
    Cease-Transcript
}

  • Record Performance – Used to record the names of all {Hardware} Assist Functions within the subdirectories.  Returns the record of all {Hardware} Assist Functions names to the display screen.
    • Export – Used to record the names of all {Hardware} Assist Functions within the subdirectories.  Returns the record of all {Hardware} Assist Functions names to the Export_<Date><Time>.log file in the identical listing from which the script was executed.
  • Offline Set up Performance – Used to put in the {Hardware} Assist Functions.
    • All – Used to put in all {Hardware} Assist Functions within the subdirectories beneath the script.
    • File – Used to put in a listing of {Hardware} Assist Functions.  The textual content file needs to be formatted with one {Hardware} Assist Software title per line.  The file ought to reside in the identical folder because the Set up-HSA.ps1 script.  The names will be discovered utilizing the -LIST parameter
    • Title – Used to put in one {Hardware} Assist Software.  The title will be discovered utilizing the -LIST 
  • NoSMSTS – used when operating in winPE, however not in a Microsoft.SMS.TSEnvironment, supplied by Microsoft Endpoint Supervisor (MEM) / System Middle Configuration Supervisor (SCCM) or Microsoft Deployment Toolkit (MDT).
    • Name this parameter with the drive letter and colon (:) the place the Home windows partition has the Home windows folder already put in.
  • DebugInformation – Used to activate transcript logging and full logging of DISM instructions.  The transcript file will be discovered at C:WindowsLogs.  There will probably be a separate log file from every DISM command generated at C:WindowsLogsDISM.

For MEM/SCCM and MDT implementations, we’re offering the next steering for the objects wanted to efficiently deploying Lenovo units.  Every implementation has steering on WinPE Elective Elements Necessities, the package deal to convey the content material to the system, and the Job Sequence activity data to carry out the set up.

MEM/SCCM Implementation

Home windows PE Elective Elements Necessities

    • Microsoft .NET (WinPE-NetFx)
    • Home windows PowerShell (WinPE-PowerShell)
    • Home windows PowerShell (WinPE-DismCmdlets)

Packaging

  1. Obtain and extract the required HSA package deal from Lenovo’s web site.
  2. Copy the Set up-HSA.ps1 script to the listing the place the HSA package deal was extracted.
    *** NOTE *** If you’re going to set up multiple HSA, however not all, and are going to make use of the -FILE parameter, make sure you embrace the textual content file with the record of HSA Names in the identical listing because the script file.
  3. Create a legacy package deal with the supply information pointed to the listing the place the HSA pack is extracted.  There isn’t any must create a program related to this legacy package deal.
  4. Distribute to your atmosphere.

Job Sequence

  1. After the Apply Working System activity, however earlier than the Setup Home windows and Configuration Supervisor activity, add a Run PowerShell Script activity.
  2. On the Properties tab, select the Choose a package deal with a PowerShell script choice.  Click on the Browse button to find and choose the package deal created above.
  3. Within the Script title textbox, enter Set up-HSA.ps1.
  4. Within the Parameters textbox, enter the parameters required.  Ex. -Offline -All -DebugInformation.
  5. On the Choices tab, if wanted, add the conditional assertion and any WMI queries to focus on by mannequin.

MDT Implementation

Home windows PE (WinPE) Options Necessities

    • .NET Framework
    • Home windows PowerShell
    • DISM Cmdlets

Software

  1. Obtain and extract the required HSA package deal from Lenovo’s web site.
  2. Copy the Set up-HSA.ps1 script to the listing the place the HSA package deal was extracted.
    *** NOTE *** If you’re going to set up multiple HSA, however not all, and are going to make use of the -FILE parameter, make sure you embrace the textual content file with the record of HSA Names in the identical listing because the script file.
  3. Create an utility in MDT.  We’ll use this to neatly retailer the information in MDT.  When the wizard asks for executable, you possibly can put something, as we is not going to be utilizing the appliance performance to put in the HSA.

Job Sequence

  1. Within the Job Sequence, after the Apply Working System activity within the Set up section, however earlier than the Restart Pc activity within the PostInstall section, add a Run Command Line activity and provides it a reputation.
  2. Within the command line, enter the next command:

powershell.exe -WindowStyle Hidden -ExecutionPolicy Bypass -Command “Copy-Merchandise ‘%DeployRootpercentApplications<ApplicationFolderNameHere>’ -Vacation spot %OSDiskpercentOSDTemp -Recurse; %OSDiskpercentOSDTempInstall-HSA.ps1 -OFFLINE -ALL -DEBUGINFORMATION; Take away-Merchandise %OSDiskpercentOSDTemp -Recurse -Power”

The command above will copy all information and folders from the Software folder outlined, execute the Set up-HSA.ps1 script, and take away the content material from the %OSDisk% drive.

  1. Remember to change <ApplicationFolderNameHere> to the precise folder title of the Software.
  2. On the Choices tab, if wanted, add the conditional assertion and any WMI queries to focus on by mannequin.

Noteworthy

  • Not Relevant HSAs – Though an HSA is in a Lenovo provided HSA pack, that doesn’t essentially imply it is going to apply to each construct of a mannequin.  For instance:
    • On the ThinkPad T15 Gen 1, not all builds of this mannequin can have an Nvidia Graphics Card, so the Nvidia Graphics HSA could or will not be wanted.
    • Many fashions have an choice to make the most of Intel Optane Storage.  The HSA is simply wanted if the system incorporates the Optane disk drive.
  • HSAs not putting in as SYSTEM account – In an MEM/SCCM Job Sequence, after the Setup Home windows and Configuration Supervisor activity, the duty sequence runs because the SYSTEM account.  Many HSAs is not going to set up underneath the SYSTEM account, so we suggest putting in in WinPE.



Supply hyperlink

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles