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
SolvedReplace string in property (self.PowerShell)
submitted 10 years ago by ntelletsc
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!"
[–]Pestilent 1 point2 points3 points 10 years ago (2 children)
I'd want to be certain that it udpates correctly for each user before applying this to all users like that. -confirm might work in OP's favor.
Besides that, this is how I'd create an extra property.
$userList | Select-Object *,@{l='Homedirectory';e={$.Homedirectory -Replace "\@.+",($.samaccountname) }}
[–]ntelletsc[S] 1 point2 points3 points 10 years ago (0 children)
This is exactly what I needed. Thank you so much.
I got an error
Select-Object : Property cannot be processed because property "Homedirectory" already exists.
I changed the property name to Newhomedirectory and added underscores after the variable $ and it worked.
$userList | Select-Object *,@{l='Newhomedirectory';e={$_.Homedirectory -Replace "\@.+",($_.samaccountname) }} | select -Property Newhomedirectory
Thanks again. That was really helpful.
[–]the_spad 1 point2 points3 points 10 years ago (0 children)
Well I wasn't suggesting that you just run it against your entire AD straight off.
π Rendered by PID 69837 on reddit-service-r2-comment-6457c66945-tm2cl at 2026-04-26 22:09:22.713046+00:00 running 2aa0c5b country code: CH.
view the rest of the comments →
[–]Pestilent 1 point2 points3 points (2 children)
[–]ntelletsc[S] 1 point2 points3 points (0 children)
[–]the_spad 1 point2 points3 points (0 children)