Latest Event Updates

Active Directory and PowerShell

Posted on Updated on

We all have added many computers to a Domain, moved them between OU’s, renamed them too. Using the Windows GUI is a tedious process with many steps. The nice thing about PowerShell is that it’s quick, easy and can be scripted to do multiple computers at one time. Even in the one computer at a time scenario it saves a few minutes a computer.

So, how do we do it? Add-Computer, Move-ADObject, Rename-Computer, Restart-Computer are all great cmdlets that make the job seamless and fast. The following command adds the local computer naming it Win10-TL to the domain called “YourDomain” and then restarts the computer to process the change in AD and on the computer immediately.

Add-Computer -ComputerName “Win10-TL” -DomainName “YourDomain” -Restart

That is way too easy for me. I need a harder way to do it so my boss thinks I’m a genius when I get things done fast and efficiently. Now, I’m all for looking like Scotty from Star Trek, but I also value my time and will look for anything that will make my job easier so that I can work on other interesting  projects.

Want to move that computer from the default Computer OU to the new OU it belongs in?

get-adcomputer Win10-TL | Move-ADObject -TargetPath ‘ou=staff computers,dc=mydomain,dc=net’

You can shorten the move command above by using other methods. One I like is placing the TargetPath into a Variable called $TP.

Work smarter, not harder.

The Power in PowerShell

Posted on Updated on

This afternoon I updated a piece of software we use for instruction and classroom management on 37 servers. The software is actually a service, while its teacher and student versions are installed on the individual classroom machines via an auto update function within the service. 

In a situation that many of us as Systems Administrators have been in, I would have normally did an RDP to each server, copied the service install, the teacher and student install to the server and ran the service MSI to install it. That would be on average 5 minutes on each server for a total time of just over 3 hours. 

To avoid that we now have PowerShell and the Power of PowerShell. I wrote a script, tested it on a Dev server until I felt comfortable that is was debugged and then ran it on the production servers. The writing of the script took a half hour, testing a half hour and running it to completion from my desk in a PowerShell console took 4 minutes. 

Yes, that’s 4 minutes to run the script to completion on all 37 servers. Add the writing and testing time and you get a total of one hour and four minutes. In my field, educational K12 we have maintenance Windows that run after school and district hours to avoid as much interruption to learning as possible. If I was to do the updates the manual method I would have had to start at 4:30pm on a Friday for 3 hours. While that would have been overtime, I would rather not stay after already working an eight hour day on a Friday if I don’t have to. 

The Power of PowerShell made it so that my total time invested in the actual update was less than 10 minutes which includes the four the script took. The hour of writing and testing the script was during my normal work day so they don’t count. Because school is out, I was able to get the school based technology support personnel to agree to not be using the servers to let me start at 4pm instead of 4:30pm at the end of our day. 

That means I was able to update a major tool of our classroom learning and IT software management during the work day in 4 minutes without any real disruption to anyone. Now that is what I consider good time management. 

Overall, I saved the district 3 hours of overtime. At the same time I saved myself from an extra 3 hours at work on top of the eight I was already working and I was able to use them with my family. I also now have a script that I can use with a multitude of software installs to save even more time. That’s the Power of PowerShell. 

Before I close I want to address the people that say I’ve hurt my value, made something that can replace me, or left pay in the bosses pockets. Well, to me those thoughts are from people who are insecure with themselves and are only looking out for themselves. I helped my value by making something that lets me spend more time on a different project that will help the students who I’m working for. I’ve also saved the district money that can be spent somewhere else that will help the students who I’m working for. We have a job not because of ourselves, but because of the end user. PowerShell makes that possible for me. 

The Mystery Error Installing WMF 5.0 and PowerShell

Posted on Updated on

It has been a long time since I wrote here wit just too much in the real world of work and family to take the time to jot anything down in words.

I use multiple computers as a Systems Administrator. I have just switched to a Surface Pro 3 with Windows 10 as my main machine at my desk connected to the newest Surface Dock. It is connected to two 24 inch monitors, with a LogicTech wireless keyboard and mouse combination. My “old” machine is an HP EliteBook 8570w with Windows 7 SP1. In the move I am trying to make sure that the machines are as mirrored as possible.

That was a touch harder than I thought with PowerShell. Since Window 10 came with WMF 5.0 when it was imaged, I had a lot of features that the Win7 machine didn’t. I had WMF 5.0 Preview installed on it but had not had the reason to update to the final release when it came out. While making the switch to the Surface Pro, I had started writing a PowerShell script using some of the new WMF 5.0 final release additions. I am still using the laptop so I wanted to make sure that it was updated in case I needed to edit the script. Well, when I tried to install the WMF final release on the Win7 laptop it decided to not install with a rude error message.

There weren’t any error codes, just that the installation had failed. I looked at all the different reasons it could have failed, the system requirements and anything that I could think of. I just wasn’t making any progress so I used my best friend, “Google.” Though, in this instance it wasn’t my best friend. But it did give me pieces. One piece in the right direction mentioned a bug in the preview WMF that would require it to be uninstalled. Great idea, just another error appeared in its place.

The new error stated that a certificate was out of date or expired. Of course the natural first step is to check your clock, which I did just because I can’t tell anyone else to do it if I don’t. I knew it was going to be fruitless because at work we use an NTP server and at home I use an app to sync to atomic time servers. So, what was causing the problem? 

I couldn’t check the cert because the error didn’t tell me which cert and I wasn’t going to spend the time writing a quick script to export cert info to a CSV. I did the next best thing which was to set the clock back to a month after I installed the preview and tried again.

Viola, it uninstalled and asked me to reboot the laptop, which I did after re-syncing the clock. The next step was to try the WMF 5.0 final release install which went perfectly smooth this time around.

Moral to the story is you really need to think through the errors, don’t give up and the answers aren’t always spelled out for you.