Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

The scritpt makes the GET, but does not do SET to change the attributes

$
0
0

This my Script.

The script excuta without errors, but does not change the attributes, help-me please


=================================================

Get-Command -Module ActiveDirectory 
$users = Get-ADUser -SearchBase "dc=icaro,dc=br" -Filter * -Properties DisplayName, Office, Department
$Users = Import-Csv -Delimiter ";" -Path "C:\Users\test\Documents\test.txt"  


ForEach ( $user in $users ) 

  $Displayname = $User.usuario
  $office = $User.Matricula 
  $Department = $user.'Local de trabalho'

"modificando $($user.usuario)" 
Get-ADUser -Filter {DisplayName -eq "$Displayname"} | 
Set-ADUser $Displayname -office $office -Department $Department

==============================================


Viewing all articles
Browse latest Browse all 15028

Trending Articles