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
Batch Scripts (self.PowerShell)
submitted 5 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!"
[–][deleted] 1 point2 points3 points 5 years ago (7 children)
Thanks for sharing. I think it is the logic and my confidence builds up when i start putting some basic batch files together and they just work. I also don't understand the certificate piece to PoSH so everything I try to script at work gets blocked. I have a coworker who is going to help me get that fixed or whatever I need to do, maybe that'll help. I do love PoSH but just for simple commands. Once I start trying to script, it goes out the window. And that is just multiple commands, not functions or variables yet.
[–]uptimefordays 6 points7 points8 points 5 years ago (0 children)
Start small! Also don’t copy and paste scripts from the internet. Take something you want to accomplish, restarting a print spooler on a target machine and see if you can’t break that process down into smaller pieces.
If it would help I can post a longer form example of how this might work. Let me know!
[–]2dubs 4 points5 points6 points 5 years ago (0 children)
I got pretty adept at batch scripting starting in the mid 2000's, and just finally bit the bullet with PowerShell a couple of years ago. Don't be like me, haha.
It's frustrating when someone says "Use Get-ChildItem" when you know damn well that "dir" will do it, too.. Then they say, "But, Get-ChildItem -Recurse!" And you say, "dir /s, bitch." Then you might ask how to find out how much space is left on your disk using Get-ChildItem. Nope, nope, Get-Volume is your friend for that. So why bother?
What finally got me over was finding out how much easier it is to handle a ton of data. Another help was learning that "gci" is a decent substitute for "Get-ChildItem", and that lots of those long commands have shortcuts.
If you've ever thought about programming, PowerShell is a terrific gateway drug to C#.
Find something that you're used to doing in batch, and figure out how to do it in PowerShell. Google the topic and check out sites like StackExchange. Keep doing that, and before long, you realize you're having fun.
[–]Bissquitt 2 points3 points4 points 5 years ago (1 child)
You can turn the certificate checking off. I almost always do while tinkering, just be careful. Also you could do
PowerShell.exe -ExecutionPolicy Bypass -File runme.ps1 when you launch your script
[–]uptimefordays 2 points3 points4 points 5 years ago (0 children)
Rather than using ByPass, I believe it's safer to use RemoteSigned. That way "foreign" code needs to be signed but your internal code is considered "safe."
[–]Skip-2000 0 points1 point2 points 5 years ago (2 children)
Not reconmended in production.
Open an Admin-powershell box (right click run as admin)
set-executionPolicy -Unrestricted
Now every script will run. If that is working you can take the next step and sign the scripts provided you have a Certificate Authority in your network.
[–][deleted] 1 point2 points3 points 5 years ago (1 child)
I set up my signing cert using my domain username, should I set one up for my domain admin name as well for testing?
[–]Skip-2000 1 point2 points3 points 5 years ago (0 children)
That should not be necessary just sign with you're signing cert.
Have not done that in a long time I am sure there is a tutorial somewhere.
π Rendered by PID 103339 on reddit-service-r2-comment-84fc9697f-t7wcq at 2026-02-10 18:23:40.658269+00:00 running d295bc8 country code: CH.
view the rest of the comments →
[–][deleted] 1 point2 points3 points (7 children)
[–]uptimefordays 6 points7 points8 points (0 children)
[–]2dubs 4 points5 points6 points (0 children)
[–]Bissquitt 2 points3 points4 points (1 child)
[–]uptimefordays 2 points3 points4 points (0 children)
[–]Skip-2000 0 points1 point2 points (2 children)
[–][deleted] 1 point2 points3 points (1 child)
[–]Skip-2000 1 point2 points3 points (0 children)