SHARE
TWEET

Untitled

a guest Aug 12th, 2016 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. $computer = $Env:ComputerName
  2. $text = "C:accounts.csv"
  3. $user = import-csv -path $text
  4.    foreach($strUser) in $user)
  5. {
  6.  $user = $struser.user
  7.  $password = $struser.password
  8.  $description =  $struser.description
  9.  $group = $struser.group
  10.  Clear-Host
  11.  $ObjOU = [ADSI]"WinNT://$computer"
  12.  $objUser = $objOU.Create("User", $user)
  13.  $objUser.setpassword($password)
  14.  $objUser.put("description",$description)
  15.  $objUser.SetInfo()
  16.  $objGroup = [ADSI]"WinNT://$computer/$group"
  17.  $objGroup.add("WinNT://$computer/$user")
  18.  $objGroup.SetInfo()
  19. }
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