daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Jul 20th, 2018 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $accountnames=foreach( $line in (net user) -split "`n"){if($line -ne "" -and  $line -notlike 'User accounts*' -and  $line -notlike '---------*' -and  $line -notlike 'The command completed*' ){ Write-Output $line}}
  2.  
  3. $accountnames=$accountnames -replace("`n|`r|\s+", ",") -split(",")
  4. $account_localgroups=foreach($account in $accountnames){if($account -ne ""){foreach($line in (net user $account)){if($line -like "Local Group Memberships*"){write-output "$account=$line`n".replace("\s+", " ").replace("*", "").replace("Local Group Memberships", "")}}}}
  5.  
  6. write-output $account_localgroups|ConvertFrom-StringData
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
 
Top