Advertisement
Guest User

Untitled

a guest
Mar 30th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. $currentusersid = Get-WmiObject -Class win32_computersystem |
  2. Select-Object -ExpandProperty Username |
  3. ForEach-Object { ([System.Security.Principal.NTAccount]$_).Translate([System.Security.Principal.SecurityIdentifier]).Value }
  4.  
  5. Invoke-Command -ComputerName 'whatever' -ScriptBlock {
  6. $currentusersid = Get-WmiObject -Class win32_computersystem |
  7. Select-Object -ExpandProperty Username |
  8. ForEach-Object { ([System.Security.Principal.NTAccount]$_).Translate([System.Security.Principal.SecurityIdentifier]).Value }
  9. }
  10.  
  11. Get-ADComputer -Filter "name -eq 'Computername'" -Properties sid | select name, sid
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement