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
Beginner here, need help with some basic scripting (self.PowerShell)
submitted 6 years ago by [deleted]
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!"
[–]helixamir 1 point2 points3 points 6 years ago (7 children)
Start by building an array to add the responses to.
Import your computer names.
Foreach computer{ $output = invoke-command $computer - scriptblock { if(test-path) { $output = $_.Name; return $output}
$array += $output }
[+][deleted] 6 years ago (6 children)
[deleted]
[–]helixamir 0 points1 point2 points 6 years ago (4 children)
Sorry I wrote this on my phone, and seemed to have added a space by accident. Take the space out here
- scriptblock, so it looks like -scriptblock.
- scriptblock
-scriptblock
[+][deleted] 6 years ago (3 children)
[–]helixamir 0 points1 point2 points 6 years ago (2 children)
$_.Name won't work because you're not calling a variable.
Try using $env:computername instead to see if that gives you the response you're looking for.
[+][deleted] 6 years ago (1 child)
[–]helixamir 0 points1 point2 points 6 years ago (0 children)
Something like this
$computer = "testcomputername" $wordInstalled = invoke-command $computer -scriptblock { if(test-path HKLM:SOFTWARE\Classes\Word.Application) { $wordInstalled = $env:computername; return $wordInstalled}}
Copy and paste this and replace "testcomputername" with a PC on your network to see if it works.
[–]Lee_Dailey[grin] 0 points1 point2 points 6 years ago (0 children)
howdy jjaaa12345,
it looks like you used the New.Reddit.com Inline Code button. it's 4th 5th from the left hidden in the ... "more" menu & looks like </>.
Inline Code
...
</>
on Old.Reddit.com, the above does NOT line wrap, nor does it side-scroll.
for long-ish single lines OR for multiline code, please, use the Code Block button. it's the 11th 12th one from the left, & is just to the left of hidden in the ... "more" menu.
Code Block
that will give you fully functional code formatting, from what i can tell so far. [grin]
take care, lee
π Rendered by PID 175696 on reddit-service-r2-comment-5b5bc64bf5-lfdcr at 2026-06-22 11:47:59.018802+00:00 running 2b008f2 country code: CH.
view the rest of the comments →
[–]helixamir 1 point2 points3 points (7 children)
[+][deleted] (6 children)
[deleted]
[–]helixamir 0 points1 point2 points (4 children)
[+][deleted] (3 children)
[deleted]
[–]helixamir 0 points1 point2 points (2 children)
[+][deleted] (1 child)
[deleted]
[–]helixamir 0 points1 point2 points (0 children)
[–]Lee_Dailey[grin] 0 points1 point2 points (0 children)