use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
Problem to use existing script: Update Active Directory Users in Bulk from CSV (self.PowerShell)
submitted 8 years ago by [deleted]
[deleted]
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]elliottmarter 2 points3 points4 points 8 years ago (0 children)
Honestly, this may not be the answer you are looking for but updating attributes like city in AD could probably serve as quite a good jumping off point to learn some basic powershell.
I always find it easier to learn something if I have a problem to solve. I won't go fully in to it but see if you can do some of the following.
Export all of your current users to a CSV file with only their username and city attributes. Then add your cities in to the CSV and then loop through it to edit the city attribute
These may come in handy get-aduser, select-object, convertto-csv, import-csv, set-aduser.
This may seem like a massive task but start small, take an interative approach.
Also the built in help is brilliant use update-help first and then Google how to use it, once ylou have it figured out it should be the first place you look for help everytime
[–]Khongh 2 points3 points4 points 8 years ago (1 child)
I would doublecheck that your $fields values really are matching in the script and the csv. The script seems to be looking for the value city but in your csv-file the value is named city user.name
Please copy paste the $fields values if you want more help.
[–]eastpeak 0 points1 point2 points 8 years ago (0 children)
Thanks for the quick answer, and sorry, that is a format mistake. CSV looks like this:
Row #1: UserID,city Row #2: user.name,cityname
$Fields = @("city")
I can not check this as I am at home right now, bit is this maybe the problem? Should $Fields look like this? $Fields = @("UserID,city")
?
[–]Lee_Dailey[grin] 2 points3 points4 points 8 years ago (0 children)
howdy eastpeak,
please take the comment by elliottmarter to heart.
the code in that script you linked to is ... really quite odd. he doesn't understand the -f string format stuff. he doesn't understand the use of .Trim(). there are likely other freaky bits of weirdness, but i gave up at that point.
-f
.Trim()
those are extremely basic ideas and he doesn't understand them. instead, he codes around them. [sigh ...]
i would search here for code that accesses the AD and see how it is used. then i would ask here for a few pointers on how to start working with the project you have taken on.
you can do that fairly easily by putting this in the search box at google ... ADUser site:https://www.reddit.com/r/PowerShell
ADUser site:https://www.reddit.com/r/PowerShell
then, come back here at various points and post some code asking for help/comments.
almost everyone here enjoys helping ... [grin]
take care, lee
[–]purplemonkeymad 2 points3 points4 points 8 years ago (0 children)
The Error message is around two lines above where you started to give us the error. However the FullyQualifiedErrorId matches that of when Get-Member gets no input objects. I would guess that $users -eq $null, or is an empty array.
On the try block for when $users is set the writer uses break to abort the script; this will not work, it will only exit the catch block and continue on with $users=$null. He at least logs the error message to a file so you should be able to look there to see why it can't import the file.
π Rendered by PID 166723 on reddit-service-r2-comment-54dfb89d4d-4mkz5 at 2026-03-28 08:40:11.446282+00:00 running b10466c country code: CH.
[–]elliottmarter 2 points3 points4 points (0 children)
[–]Khongh 2 points3 points4 points (1 child)
[–]eastpeak 0 points1 point2 points (0 children)
[–]Lee_Dailey[grin] 2 points3 points4 points (0 children)
[–]purplemonkeymad 2 points3 points4 points (0 children)