log serial via ad

a guest Jun 26th, 2019 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $sn = Get-WmiObject -Class Win32_bios | Select-Object -ExpandProperty serialNumber
  2. $computer = $env:COMPUTERNAME
  3. Set-ADComputer -Identity $computer -Replace @{serialNumber = $sn } -ErrorAction SilentlyContinue -ErrorVariable $serialAddErr -WarningVariable $serialAddEWarn
  4. $serialAddErr | Out-File -FilePath c:\serialAddErr.txt -Append
  5. $serialAddEWarn | Out-File -FilePath c:\serialAddErr.txt -Append
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand