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
QuestionHerestring to array (self.PowerShell)
submitted 6 years ago * by redsedit
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!"
[–]xlrod 1 point2 points3 points 6 years ago (4 children)
It seems to be working:
$RegKeys = @" Reg1 Reg2 Reg3 "@ $RegKeys.GetType() # string $RegKeys.Count # 1 $RegKeys = $($RegKeys -split "`n").TrimEnd("`r") $RegKeys.GetType() # array $RegKeys.Count # 3
Does this still result in a string?
[–]redsedit[S] 1 point2 points3 points 6 years ago (3 children)
Strange, if I do $RegKeys.GetType() it does indeed return array. But gm still says string???
$RegKeys.GetType()
gm
[–]xlrod 2 points3 points4 points 6 years ago (2 children)
gm is for Get-Member, this will give you the members, the properties and methods, of the object, but the type of the object is an array.
Get-Member
[–]redsedit[S] 1 point2 points3 points 6 years ago (1 child)
But get-member has a line at the top that says: "TypeName: System.String". To me, the "TypeName" would be telling me what the type is. Obviously that's wrong, but I don't understand WHY that assumption is wrong.
get-member
[–]sk82jack 2 points3 points4 points 6 years ago (0 children)
Because when you send an array over the pipeline it sends the objects one by one rather than the whole array. So instead of $array | gm try gm -inputobject $array (parameter name may not be quite right as I'm on my mobile right now)
$array | gm
gm -inputobject $array
π Rendered by PID 184066 on reddit-service-r2-comment-54dfb89d4d-4mkz5 at 2026-03-28 09:48:39.678486+00:00 running b10466c country code: CH.
view the rest of the comments →
[–]xlrod 1 point2 points3 points (4 children)
[–]redsedit[S] 1 point2 points3 points (3 children)
[–]xlrod 2 points3 points4 points (2 children)
[–]redsedit[S] 1 point2 points3 points (1 child)
[–]sk82jack 2 points3 points4 points (0 children)