My PowerShell Scripts - Systems Administration
HTML-код
- Опубликовано: 11 сен 2024
- Automating your routine tasks is one of the key components to performing Systems Administration tasks. Here I show you what I have setup.
Using PowerShell, I am able to utilize scripts (in the form of functions within a module) to help me perform some simple yet important tasks. A quick side-note, I use the following scripts/functions in PowerShell V3. I have not tested them all in V2.
Affiliate Links:
My personal laptop: amzn.to/3GG5U4g
My work laptop: amzn.to/46XtDaT
My sit/stand desk: amzn.to/3TLn08F
Just now learning powershell and I was looking for some inspiration. This might be 9 years old but it fits the bill, much thanks!
Awesome! Never too late to learn Powershell. I still use it daily... a lot :) Glad ya found it helpful.
@@PC-Addictsdo you have a link for these scripts?
Every once in a while I would like to automate some tasks, but never took the time to learn, but this makes me think again about setting aside time to get the basics down and start learning as I go.
I just wanted to thank you for taking the time to put this video up. I am current enrolled in an IT program at my local community college, but I was thinking of also taking the Network Specialist program when I am finished with the CSS program seeing how the two have a majority of the same core classes at my school. So, your videos are a good way to see some of the material I will be faced with in the coming year giving me a heads up here and there.
You are welcome! Glad you are finding the videos helpful. Keep learning all you can in your classes! It will pay off in the end!
As a new System Administrator, I have come to enjoy you videos...particularly the 15 part Server lessons... Thanks
You are welcome - I was going to start a PowerShell series, but then thought I would start that another time rather than for this one.
Best way to learn my friend, just figure out something that would make your daily tasks more automated and rock and roll! :)
You rock! This is still useful today. Thank you for providing this information for free. You are an awesome guy
Your welcome and thanks for the kind words! Glad it's helpful!
Thanks a mill Chris, I would love to see a series on Powershell man.
Keep up the awesome work.
I always asked if they restarted their computer. If you have fast startup enabled, the uptime does not reset always so keep that in mind. I generally would disable fast startup organization-wide so restarting actually fixes an issue you are trying to fix.
neat, glad i've stumbled upon this, just recently started in the industry, this inspired me to compose my library. thx
Your welcome - keep us updated!
Thanks... I agree with what you said. As I'm sure you are aware, these are just a couple tiny little examples of the things you can do. Maybe one day I will show you all a few things we do at work that are really super amazing. One of our System Admins is really good with PowerShell and has written a ton of things that helps the hospital tremendously.
Awesome! So glad you found this helpful... Hope it helps others out there as well. If you figure out the best way via Unix, let us know! :)
Been doing a bit of work on the house, and I also bought a Raspberry Pi before Xmas, very distracting, but good fun! don't worry, I'm working on some new tutorials and will be uploading very soon...
Nice! I know the feeling about working on the house... it's crunch time for me now (going to sell this house so need to finish the complete remodel very quickly now).
Thanks man! Appreciate your support! Haven't seen any videos recently from ya... what's up?!
Nice!! Sounds almost identical to what we have setup at work as well.... Awesome man!!
Thanks for the comments. I would be very careful about using any script you find on the internet (unless it's from a few well respected PowerShell people). I know what you mean about 'not clicking'... I was in the same spot too at first. The best advice I can give is to find some basic tutorials (especially from Don Jones) and go from there. He really explains things in a simplified way.
I personally have it imported when PowerShell is launched. You can place the following command in your $profile
import-module (full path to module)
I recently wrote a script to query all AD users that have mailboxes, with passwords about to expire. It then emails each user at the 14 day mark letting them know that they need to think about changing there password, at the 5 day mark it then emails them everyday until the 1 day mark. I have it ran through a scheduled task at 10 am everyday. The nice part about this is we all get email alerts CC to our mailboxes. I found we had to do this since our Execs would ignore the pop up in Win7.
I've been looking for a way to know who is logged into a computer, I just wish it could be run from samba/unix but better than nothing at this point. Also, I didn't even realize I had a need for the driver script until I watched this. As always thanks for the great videos and insight!
CoryClaxon won the last one... I think I might have one more to giveaway as well as an SSD and gold plated flash drive! Keep an eye out!
Fantastic to watch you I am just starting to learn the basics very impressive videos
Great video Chris, very useful stuff.
Your links aren't there anymore, I was curious on getting the full PS scripts for Get-Uptime and Get-HW if you still had them. Thanks!
cool idea. I need to create some modules for the Systems Administration team at my office. Trying to get them to use any type of automation (particularly vbscript or powershell) is very difficult. There is one guy (a contractor) that is all over it, the others are very slow to adopt... Don Jones did some cool videos about dressing them up for non-(command line/script) folks that was really cool. You should do a video about something similar to that.
damn I'm kinda late but this motivated me to do more powershell
Hell ya!
Cool... I'll keep them coming!
Your links don’t work anymore.
Yeah, I took down the site (was costing me money and not worth keeping it around). Hit me up and I will try and help provide whatever ya need.
It's not hard.. in fact, it's not bad at all. We have an awesome group of people and documentation that helps a lot. Uptime for clients probably average 30 days or so. Uptime for servers are 30 days since we have a scheduled monthly server update/reboot night every month. We have over 120 servers (give or take a few). 98% of them are Windows servers. Couple *nix servers.
Thanks! When you say "the same way", would you mind being a tad bit more specific? I want to find out what people want to watch/learn/etc... Thanks man! :)
Great video, thanks for posting. I am a total windows noob - does windows not already have built in commands that would provide these functions? I hate to be "that guy", but everything you did with a script is just a built in command in Linux.
Hello, when trying the Get-LoggedIn script I get an error
gwmi : The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
At line:9 char:19
Could you possibly help? Thank you.
Interesting, however I don't see anything that can't be achieved using WMIC in cmd. For example Get-LoggedIn can be achieved with;
wmic /node:'hostname' computersystem get username
I guess its nice to have these scripts run from a short command, however when I need to access data like this its not imperative to be as fast as possible. Just my observation.
this is a helpful video. do you have any more examples of scripts you use?
I don't have any current/updated videos, but I do have a few more helpful ones that I use. I really need to record a few updated ones, maybe one day lol
Hi, is there any book you would recomend where i can learn to make scripts on PS? Thanks
very helpful- thanks for the effort!
Try OCS-ng or sonething in this style for this purposes.
Hi Sir,
How can I use power shell to write down PC Lock time and PC unlock time in any of the text applications?
I'm trying to figure out how to pull the Get-HWVersion function?
Sorry, the Get-HWVersion function is a custom function written and placed in a module for my profile to pick up and use.
I meant to writeup a script that utilizes this and share but I've yet to find the time. Until then if anyone is curious it looks like there is a WMI Client package offered by orvant.
is there a way to force admin yourself using power shell?
How does this work in a non-domain environment and how to provide usrname,pass?
how do I import the function to my personal profile?
Sorry for the delay, do you still need assistance?
Excellent
Thanks!
I need a powershell script that can check what computers are online or offline and will email me a list of computers that need to be restarted.
Welcome :)
Awesome video, ty
Greate job, it-bro! Thank you very very!
❤where can we find this scripts? Do you have a GitHub?
Sorry never set one up yet. Time isn't on my side at the moment.
Great Share!
Thanks, Good stuff!!!
is it hard to work in a hospital? Whats the uptime like. Do they still run Windows XP or 7. What type of servers are there like the software. Windows Servers or Linux?
I ran these commands but it's not working on my office computer. Since I work in a company that provide support to remote users, I was trying to see if this would work. I tried on my personal laptop with the localhost but didn't work. Do I have to run the PS admin or what?
What command(s) are you trying to run specifically. Also, what error(s) are you seeing?
@@PC-Addicts I tried to run the "function p { " part and got "p : The term 'p' is not recognized as the name of a cmdlet, function....... At line:1 char:1......
How do you have your security setup for using Powershell on your network? I work at a school board and would love to be able to remote out to teacher laptops to check driver versions and setup printers remotely using Power Shell but I believe it is restricted right now.
Any advice how to allow remote access via Power Shell without compromising security? Thanks,
change the execution restriction thingy to UnsignedRemote or something like that. It requires all remote scripts to be signed. or just change it to signed so all scripts have to be signed
You need to enable 'psremoting' on all computers, to be able to remote on to them. Also, u need admin rights.
Oh that might be handy, thx ^^
Thanks, I really want to learn some PowerShell and you know have power over my PC even though I already have it but you get the point lol
Thank you
Subscribed! :)
how do you print a word document or text file from powershell or powershell ise?
docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/out-printer?view=powershell-5.1
Would you explain how can I retrieve all users having local admin privilege ?
gallery.technet.microsoft.com/scriptcenter/Get-the-Membership-of-09367c08
Curious: Is anyone out there looking for more PowerShell-related videos?
Hi, just learning Powershell, so would be interested in your videos. Can I get a copy of your scripts?
Ta.
@@reggieperrin8415 Thanks for your feedback! I am planning to put some out on Github in the near future!
Did you code that in c++? It looks similar?
SUperlike
Me? Not at all...
For once in my Career, I can read a foreign language/syntax and have a vague understand as to what is going on logically.
P:S.
LOL @ 2:42
Nope - PowerShell