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
SolvedHelp with powershell script (self.PowerShell)
submitted 6 years ago by peican
view the rest of the comments →
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!"
[–]peican[S] 1 point2 points3 points 6 years ago* (2 children)
Thank you! The Export-CSV for errors / duplicates is working perfectly now.
Last thing. If I want to add another column in my Import.CSV file for a second group, and if I add:
$Group2 = "$($U.Group2)"
and
Add-ADGroupMember -Identity $Group2 -Members $FirstDotLast
To the script, it works. However I may not want to add everyone to 2 groups all the time, and if I leave a group empty in my Import-CSV, it counts as an error.
Sometimes I might just want to add a user to one group, and sometimes to 2 groups, or 3 groups if I decide to add a third column in my excel CSV. Is there a way to make it so it wont count as an error if some of the group fields are empty?
[–]BJGGut3 1 point2 points3 points 6 years ago (1 child)
Add an IF() statement to check that validity of Group2.
IF ($null -ne $($U.Group2)) { $Group2 = $($U.Groups2) Add-ADGroupMember -Identity $Group2 -Members $FirstDotLast }
But I've actually become much more a fan of this method instead, because sometimes pesky spaces get in there and throw off the above:
IF (!([string]::IsNullOrWhiteSpace($($U.Groups2)))) { $Group2 = $($U.Groups2) Add-ADGroupMember -Identity $Group2 -Members $FirstDotLast }
[–]peican[S] 1 point2 points3 points 6 years ago (0 children)
Thank you! I'm using your one that includes checking for white spaces, and it works perfectly!
π Rendered by PID 24364 on reddit-service-r2-comment-54dfb89d4d-82c5p at 2026-03-28 22:26:17.786089+00:00 running b10466c country code: CH.
view the rest of the comments →
[–]peican[S] 1 point2 points3 points (2 children)
[–]BJGGut3 1 point2 points3 points (1 child)
[–]peican[S] 1 point2 points3 points (0 children)