Sunday 20 September 2009

Get-PlatformId.ps1

  1. <# 
  2. .SYNOPSIS 
  3.     This script displays the platform id of the system 
  4. .DESCRIPTION 
  5.     This script is a rewrite of an MSDN sample. It  
  6.     gets System.Environment.Version's Platform field 
  7.     and displays it. The sample is simplified from 
  8.     the C# version! Not tested except on Server 2008. 
  9. .NOTES 
  10.     File Name  : Get-PlatformId.ps1 
  11.     Author     : Thomas Lee - tfl@psp.co.uk 
  12.     Requires   : PowerShell V2 
  13. .LINK 
  14.     This script posted to: 
  15.         http://www.pshscripts.blogspot.com 
  16.     MSDN Sample posted at: 
  17.         http://msdn.microsoft.com/en-us/library/3a8hyw88.aspx 
  18. .EXAMPLE 
  19.     PSH [C:\foo]: .Get-PlatformID.ps1' 
  20.     Platform ID: Win32NT 
  21. #> 
  22.  
  23. ## 
  24. # Start of Script 
  25. ## 
  26.  
  27. #Get OS Version from System.Environment 
  28. $OS  =  [System.Environment]::OSVersion 
  29.  
  30. # Get and display the PlatformID 
  31. $Platformid$OS.Platform; 
  32. "Platform ID: {0}" -f $Platformid 
  33. # End of script 

No comments: