Skip to content

Instantly share code, notes, and snippets.

@FlorianAlikoff
Created February 21, 2014 13:56
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 FlorianAlikoff/13374c15f16c0974d4ae to your computer and use it in GitHub Desktop.
Save FlorianAlikoff/13374c15f16c0974d4ae to your computer and use it in GitHub Desktop.
# Define Get Computer GUID Function
# Credit: Johan Åkerström
# http://blog.cosmoskey.com/powershell/desired-state-configuration-in-pull-mode-over-smb/
Function Get-ComputerGuid {
param(
[Parameter(Mandatory=$true)]
[string]$ComputerName
)
process {
([guid]([adsisearcher]"(samaccountname=$ComputerName`$)").FindOne().Properties["objectguid"][0]).Guid
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment