27 March 2015

OS Detection

Recently, we added the Windows 8.1 operating system to the company domain. I ran into the problem of deploying Adobe Flash Player to these systems because the ActiveX does not get installed. The issue came up in SCCM where I needed a detection method for the OS using file, registry, or product ID. I needed a way to detect the plugin and windows 8.1 to be able to validate a successful deployment. This gave me the idea to write a powershell script to place a file in the windows directory that is named for the operating system that is running. It makes for easy OS detection in SCCM for future deployments.

You can download the link from here.

 <#  
 .SYNOPSIS  
   Operating System  
 .DESCRIPTION  
   This script will detect what operating system is installed  
   and write a file named for that OS to the windows directory.  
 .EXAMPLE  
   powershell.exe -executionpolicy bypass -file OperatingSytem.ps1  
 #>  
   
 cls  
 $OS = Get-WmiObject -Class Win32_OperatingSystem -ComputerName .  
 Switch ($OS.Version) {  
      5.0.2195 {New-Item -Name "Windows 2000" -Path $env:windir -ItemType File}  
      5.1.2600 {New-Item -Name "Windows XP" -Path $env:windir -ItemType File}  
      5.2.3790 {New-Item -Name "Windows XP 64-Bit" -Path $env:windir -ItemType File}  
      6.0.6000 {New-Item -Name "Windows Vista" -Path $env:windir -ItemType File}  
      6.0.6001 {New-Item -Name "Windows Vista SP1" -Path $env:windir -ItemType File}  
      6.0.6002 {New-Item -Name "Windows Vista SP2" -Path $env:windir -ItemType File}  
      6.1.7600 {New-Item -Name "Windows 7" -Path $env:windir -ItemType File}  
      6.1.7601 {New-Item -Name "Windows 7 SP1" -Path $env:windir -ItemType File}  
      6.2.9200 {New-Item -Name "Windows 8" -Path $env:windir -ItemType File}  
      6.3.9600 {New-Item -Name "Windows 8.1" -Path $env:windir -ItemType File}  
 }  
   

Related Posts:

  • Automating the Creation of Software Update Groups in SCCM I have been working on automating the tasks of deploying Windows updates each month. You may think why is there a need for this when SCCM has the Automatic Deployment Rules. Some companies have to review the updates be… Read More
  • NIC Power Management Properties I wrote and published a script that enabled wake on lan two years ago. Since then, I have needed to write new scripts to modify the advanced tab of the NIC properties. I began by looking at my old script to see about adding… Read More
  • Update Drivers and BIOS via PowerShell and Dell Command Update NOTE: I used Sapien's PowerShell Studio to write this script that significantly simplified the process! During the build process, I execute the Dell Command Update to make sure the latest drivers and BIOS version… Read More
  • Query Event Logs to a Central Log File Recently, we have had sporadic issues with Outlook and needed to see who all was experiencing the problem. We knew it was logged in the event viewer logs. I decided to write a PowerShell script, with the help of Sapien Tech… Read More
  • Font Installation Script I had a bunch of fonts that need to be installed during the build of  the golden image. I wrote this script to install them as a task sequence, but also to be able to deploy the fonts easily through SCCM. This script w… Read More

0 comments:

Post a Comment