daily pastebin goal
8%
SHARE
TWEET

Untitled

a guest Dec 7th, 2017 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. net user $env:USERNAME /domain
  2.  
  3. (New-Object -TypeName System.DirectoryServices.DirectorySearcher("(&(objectCategory=User)(samAccountName=$($env:USERNAME)))")).FindOne().GetDirectoryEntry().memberOf
  4.  
  5. ([ADSISEARCHER]"samaccountname=$($env:USERNAME)").Findone().Properties.memberof -replace '^CN=([^,]+).+$','$1'
RAW Paste Data
Top