Update userWorkstations Attribute of Users in Bulk from CSV

PowerShell script to update the userWorkstations attribute of Active Directory users in bulk from the information in a CSV file. Computer names can be added and/or removed from the attribute.

 
 
 
 
 
4 Star
(1)
574 times
Add to favorites
Active Directory
1/5/2019
E-mail Twitter del.icio.us Digg Facebook
  • Get error of "AD modules not supported, script aborted."
    1 Posts | Last post September 18, 2019
    • Hi Richard,
      
      First of all, thank you for your great scripts.
      
      I tried to run the script and it show an error message as captioned in my question.
      
      After checking your code, the error due to failure of line 52, [$NTNames = Get-ADComputer -Filter * | sAMAccountName]
      
      So, I tried to run [Get-ADComputer -Filter * | sAMAccountName] in PowerShell command prompt and get error.
      
      PS C:\source> Get-ADComputer -Filter * | sAMAcountName
      sAMAcountName : The term 'sAMAcountName' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
      At line:1 char:28
      + Get-ADComputer -Filter * | sAMAcountName
      +                            ~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (sAMAcountName:String) [], CommandNotFoundException
          + FullyQualifiedErrorId : CommandNotFoundException
      
      
      Below please find my $PSVserionTable result
      Name                           Value
      ----                           -----
      PSVersion                      4.0
      WSManStackVersion              3.0
      SerializationVersion           1.1.0.1
      CLRVersion                     4.0.30319.42000
      BuildVersion                   6.3.9600.19170
      PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0}
      PSRemotingProtocolVersion      2.2
      
      Could you please help to solve my issue? Thanks.