Skip to content

Instantly share code, notes, and snippets.

@phwelo
Last active February 5, 2018 19:15
Show Gist options
  • Save phwelo/d8c067d91aea6c8813a3 to your computer and use it in GitHub Desktop.
Save phwelo/d8c067d91aea6c8813a3 to your computer and use it in GitHub Desktop.
[Powershell WMI Converter thing] Powershell function to prefix 0's to make a deviceID from powershell WMI output #Powershell #WMI
#Example: Output-FixedLengthString 5 10
#Output will be: 00010
Function Output-FixedLengthString{
param( [int]$EndLength, [string]$StrSubject )
do { $StrSubject = "0$StrSubject"
$length = $StrSubject.length
} until ($length -eq $EndLength)
return $StrSubject
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment