09 February 2015

Deploying Windows Management Framework 4.0

This PowerShell script will install WMF 4.0. It will return an error if the installation fails.

You can download the script from here.


 <#  
 .Author  
      Mick Pletcher  
 .Date  
      29 July 2014  
 .SYNOPSIS  
   Windows Management Framework 4.0  
 .EXAMPLE  
      powershell.exe -executionpolicy bypass -file install_WMF4.ps1  
 #>  
   
 #Declare Global Memory  
 Set-Variable -Name Errors -Value $null -Scope Global -Force  
 Set-Variable -Name RelativePath -Scope Global -Force  
 Set-Variable -Name Title -Scope Global -Force  
   
 Function ConsoleTitle ($Title){  
      $host.ui.RawUI.WindowTitle = $Title  
 }  
   
 Function DeclareGlobalVariables {  
      $Global:Title = "Windows Management Framework 4.0"  
 }  
   
 Function GetRelativePath {   
      $Global:RelativePath = (split-path $SCRIPT:MyInvocation.MyCommand.Path -parent)+"\"   
 }  
   
 Function InstallMSU ($ProgName,$MSU,$Switches) {  
      $EXE = $Env:windir+"\system32\wusa.exe"  
      $Parameters = [char]34+$MSU+[char]34+[char]32+$Switches  
      Write-Host "Install "$ProgName"....." -NoNewline  
      $ErrCode = (Start-Process -FilePath $EXE -ArgumentList $Parameters -Wait -Passthru).ExitCode  
      If (($ErrCode -eq 0) -or ($ErrCode -eq 3010)) {  
           Write-Host "Success" -ForegroundColor Yellow  
      } elseif ($ErrCode -eq 2359302) {  
           Write-Host "Already Installed" -ForegroundColor Green  
      } else {  
           Write-Host "Failed with error code "$ErrCode -ForegroundColor Red  
           $Global:Errors++  
      }  
 }  
   
 Function ExitPowerShell {  
      If (($Global:Errors -ne $null) -and ($Global:Errors -ne 0)) {  
           Exit 1  
      }  
 }  
   
 cls  
 DeclareGlobalVariables  
 GetRelativePath  
 ConsoleTitle $Global:Title  
 InstallMSU "Windows Management Framework 4.0" $Global:RelativePath"Windows6.1-KB2819745-x86-MultiPkg.msu" "/quiet /norestart"  
 Start-Sleep -Seconds 5  
 ExitPowerShell  
   

Related Posts:

  • Install Configuration Manager PowerShell Module I wanted to install the Configuration Manager PowerShell module on my admin machine. After investigating a little, the module does not exist in the Microsoft PowerShell gallery. The PowerShell script below will create th… Read More
  • Using PowerShell for SQL Backup Verification Earlier this year, we had a non-critical SQL server to crash. Come to find out, the backups were successful every night, but the data in the backup was corrupt. Needless to say, the server had to be recreated from scratch. … Read More
  • WMI Query for Dell Manufacture and First Power On Date A recent project of mine was to obtain the Dell manufacture and ownership dates from all systems for depreciation and lifecycle purposes. This information is not readily available in SCCM and on the local machines. Luckily,… Read More
  • SCCM Client Installer for MDT Recently, I wanted to revisit the process of installing the SCCM client during an MDT task sequence. At first, I tried to use the SCCM PowerShell module to initiate the install. I learned during testing that it does not wor… Read More
  • Zero Touch Dell Command Update for SCCM and MDT I have used the Dell Command | Update in the build for quite some time for managing the drivers on systems because it makes it a hand-off approach with little setup and reliable updates direct from Dell. The one thing I hav… Read More

0 comments:

Post a Comment