Skip to content

Instantly share code, notes, and snippets.

@danjpadgett
Created April 22, 2016 16:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save danjpadgett/54f0f7690416a38e30da6ab40d6cd87d to your computer and use it in GitHub Desktop.
Save danjpadgett/54f0f7690416a38e30da6ab40d6cd87d to your computer and use it in GitHub Desktop.
<#
.NOTES
===========================================================================
Created on: 22/04/2016 16:27
Created by: dpadgett
Organization: -
Filename: ZTi.ps1
===========================================================================
.DESCRIPTION
Names PC during SCCM OSD With Fixed Value (HAIG) + Serial from WMI (Truncated) (LOC = Location)
#>
$Serial = Get-WmiObject -Query 'select IdentifyingNumber from Win32_ComputerSystemProduct' -Namespace 'Root\cimv2'
$Model = Get-WmiObject -Query 'select Name from Win32_ComputerSystemProduct' -Namespace 'Root\cimv2'
$SerialNo = $Serial.IdentifyingNumber.SubString(3)
$TS = New-Object -ComObject "Microsoft.SMS.TSEnvironment"
$TS.Value("OSDComputername") = 'LOC-' + $SerialNo
## Example Locatio would be LOC-54477X4
$TS.Value("XModel") = $Model.Name
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment