7.5 C
New York
Sunday, January 14, 2024

Half 1 Creating the Apps


This weblog put up is a part of a collection of posts that may reveal methods of leveraging the System Replace Suite of instruments (Lenovo System Replace, Skinny Installer and Replace Retriever) in a Microsoft Endpoint Supervisor – Configuration Supervisor atmosphere.  This collection will present deploy the purposes to purchasers, configure purchasers to replace on a scheduled foundation, keep and deploy a repository, and report outcomes from purchasers.

Half 1:  Creating the Apps

Step one in deploying these instruments to purchasers is creating an Software and Deployment Kind in Configuration Supervisor which could be time consuming.  In case you’re excited about piloting Lenovo System Replace and/or Skinny Installer in your enterprise, the beneath script can save time in relation to performing this job.

What it does:

  • Downloads the present model of System Replace or Skinny Installer from Lenovo
  • Verifies the installer is signed by Lenovo (cannot be too cautious)
  • Creates a brand new Software in ConfigMgr
    • Populates fields similar to Localized App Identify, Hyperlink to the device touchdown web page, Localized description, Model
  • Creates a Script Installer Deployment Kind with Set up/Uninstall instructions
    • Registry detection technique for System Replace
    • File System detection technique for Skinny Installer
  • Distributes the brand new app to a Distribution Level
Upon getting the Software and Deployment outlined, merely promote to a group of your Lenovo PCs.
Right here is the script. It can be downloaded from my GitHub.  As new variations of the instruments are launched, the script shall be up to date if wanted.

(Word: Designed to be run on the Web site Server)

<#

DISCLAIMER:

These pattern scripts aren't supported below any Lenovo commonplace help

program or service. The pattern scripts are offered AS IS with out guarantee

of any form. Lenovo additional disclaims all implied warranties together with,

with out limitation, any implied warranties of merchantability or of health for

a selected function. The whole threat 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 chargeable for any damages in any respect (together with,

with out limitation, damages for lack of enterprise earnings, enterprise interruption,

lack of enterprise data, or different pecuniary loss) arising out of the use

of or incapability to make use of the pattern scripts or documentation, even when Lenovo

has been suggested of the potential of such damages.

#>
<#
	.SYNOPSIS
		Create a ConfigMgr Software for Lenovo System Replace or Skinny Installer

	.DESCRIPTION
		Script will obtain the newest model of System Replace or Skinny Installer from Lenovo's help web site, creates a ConfigMgr Software/Deployment Kind, and distributes to a Distribution Level

	.PARAMETER SystemUpdateSourcePath
		Supply location System Replace executable shall be downloaded to

	.PARAMETER ThinInstallerSourcePath
		Supply location Skinny Installer executable shall be downloaded to

	.PARAMETER DistributionPoint
		FQDN Identify of a ConfigMgr Distribution Level

	.NOTES
		Run script as Administrator on Web site Server
		Flip off Web Explorer Enhanced Safety Management for Directors previous to operating

	.EXAMPLE
        	.Create-ConfigMgrSU_TIApplication.ps1 -SystemUpdateSourcePath "ShareSoftwareLenovoSystemUpdate5.07.88" -DistributionPoint "dp.native"

	.EXAMPLE
		.Create-ConfigMgrSU_TIApplication.ps1 -ThinInstallerSourcePath "ShareSoftwareLenovoThinInstaller1.3.00018" -DistributionPoint "dp.native"

#>

[CmdletBinding()]
param
(
    [Parameter(Mandatory=$false)]
    [ValidateNotNull()]
    [String]$SystemUpdateSourcePath,

    [Parameter(Mandatory=$false)]
    [ValidateNotNullOrEmpty()]
    [String]$ThinInstallerSourcePath,

    [Parameter(Mandatory=$true, HelpMessage = "Specify FQDN of a Distribution Point")]
    [String]$DistributionPoint = 'FQDN of Distribution Level'

)

# Parse the TVT Admin Instruments net web page for the the present variations
$path = "https://help.lenovo.com/options/ht037099"
$ie = New-Object -ComObject InternetExplorer.Software
$ie.seen = $false
$ie.navigate($path)
whereas ($ie.ReadyState -ne 4) { Begin-Sleep -Milliseconds 100 }
$doc = $ie.doc

If ($SystemUpdateSourcePath)
    {
        $suExeURL = $doc.hyperlinks | ? { $_.href.Comprises("system_update") -and $_.href.EndsWith(".exe") } | % { $_.href }
        $suExe = $suExeURL.Cut up('/')[5]
        $suExeVer = $suExe.Cut up('_')[2].TrimEnd('.exe')
        # Downloading System Replace to supply location
        Invoke-WebRequest -Uri $suExeURL -OutFile "$SystemUpdateSourcePath$suExe"
    }

If ($ThinInstallerSourcePath)
    {
        $tiExeURL = $doc.hyperlinks | ? { $_.href.Comprises("thin_installer") -and $_.href.EndsWith(".exe") } | % { $_.href }
        $tiExe = $tiExeURL.Cut up('/')[5]
        # Downloading Skinny Installer to supply location
        Invoke-WebRequest -Uri $tiExeURL -OutFile "$ThinInstallerSourcePath$tiExe"
        $tiExeVerRaw = (Get-ChildItem -Path "$ThinInstallerSourcePath$tiExe").VersionInfo.FileVersionRaw
        $tiExeVer = "$($tiExeVerRaw.Main).$($tiExeVerRaw.Minor).$($tiExeVerRaw.Construct)"
    }

$ie.Give up() > $null

<#
Saving the Thumbprint of the System Replace and Skinny Installer certificates as a variable
These will finally change as soon as a brand new certificates has been issued for every
#>

$Thumbprint = "CC5EE80524D43ACD5A32AB1F3A9D163CEE924443"

# Evaluate Certificates Thumbprints to confirm authenticity.  Script errors out if thumbprints don't match.
If ($SystemUpdateSourcePath)
    {
        If ((Get-AuthenticodeSignature -FilePath $SystemUpdateSourcePath$suExe).SignerCertificate.Thumbprint -ne $Thumbprint)
            {
                Write-Error "Certificates thumbprints don't match.  Exiting out" -ErrorAction Cease
            }
    }

If ($ThinInstallerSourcePath)
    {
        If ((Get-AuthenticodeSignature -FilePath $ThinInstallerSourcePath$tiExe).SignerCertificate.Thumbprint -ne $Thumbprint)
            {
                Write-Error "Certificates thumbprints don't match. Exiting out" -ErrorAction Cease
            }
    }

# Import ConfigMgr PS Module
Import-Module $env:SMS_ADMIN_UI_PATH.Exchange("bini386", "binConfigurationManager.psd1") -Drive

# Hook up with ConfigMgr Web site
$SiteCode = $(Get-WmiObject -ComputerName "$ENV:COMPUTERNAME" -Namespace "rootSMS" -Class "SMS_ProviderLocation").SiteCode
If (!(Get-PSDrive $SiteCode)) { }
New-PSDrive -Identify $SiteCode -PSProvider "AdminUI.PS.ProviderCMSite" -Root "$ENV:COMPUTERNAME" -Description "Major Web site Server" -ErrorAction SilentlyContinue
Set-Location "$SiteCode`:"

# Create the System Replace App
If ($SystemUpdateSourcePath)
    {
        If (!(Get-CMApplication -ApplicationName "System Replace-$suExeVer")) `
             Add-CMScriptDeploymentType -DeploymentTypeName "System Replace-$suExeVer" `
                    -ContentLocation $SystemUpdateSourcePath `
                    -InstallCommand "$suExe /verysilent /norestart" `
                    -UninstallCommand "unins000.exe /verysilent /norestart" `
                    -UninstallWorkingDirectory "%PROGRAMFILES(X86)%LenovoSystem Replace" `
                    -AddDetectionClause $clause1 `
                    -InstallationBehaviorType InstallForSystem `
                    -Verbose
            
    }

# Create the Skinny Installer App
If ($ThinInstallerSourcePath)
    {
        If (!(Get-CMApplication -ApplicationName "Skinny Installer-$tiExeVer"))
            {
                $tiApp = New-CMApplication -Identify "Skinny Installer-$tiExeVer" `
                    -Writer "Lenovo" `
                    -SoftwareVersion "$tiExeVer" `
                    -LocalizedName "Lenovo Skinny Installer" `
                    -LocalizedDescription "Skinny Installer is a smaller model of System Replace." `
                    -LinkText "https://help.lenovo.com/options/ht037099#ti" `
                    -Verbose

                # Create Registry detection clause
                $clause2 = New-CMDetectionClauseFile -Path "%PROGRAMFILES(x86)%LenovoThinInstaller" `
                    -FileName "ThinInstaller.exe" `
                    -PropertyType Model `
                    -Worth:$true `
                    -ExpressionOperator IsEquals `
                    -ExpectedValue $tiExeVer `
                    -Verbose

                # Add Deployment Kind
                $tiApp | Add-CMScriptDeploymentType -DeploymentTypeName "ThinInstaller-$tiExeVer" `
                    -ContentLocation $ThinInstallerSourcePath `
                    -InstallCommand "$tiExe /VERYSILENT /SUPPRESSMSGBOXES /NORESTART" `
                    -UninstallCommand 'powershell.exe -Command Take away-Merchandise -Path "${env:ProgramFiles(x86)}LenovoThinInstaller" -Recurse' `
                    -AddDetectionClause $clause2 `
                    -InstallationBehaviorType InstallForSystem `
                    -Verbose
            }
    }

# Distribute app to Distribution Level
If ($SystemUpdateSourcePath)
     Begin-CMContentDistribution -DistributionPointName $DistributionPoint -ErrorAction SilentlyContinue -Verbose
    

If ($ThinInstallerSourcePath)
     Begin-CMContentDistribution -DistributionPointName $DistributionPoint -ErrorAction SilentlyContinue -Verbose
    

Set-Location -Path $env:HOMEDRIVE



Supply hyperlink

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles