Subscribe to RSS Subscribe to Comments

Mindless Conversation

Remotely Reboot Servers with Powershell

I needed to remotely reboot some servers in batches. Here is some quick code to reboot the servers. The script will issue the first reboot using the server names in the first .txt file. it will then pause and display a popup, wait 8 minutes and then fire off the second .txt file.   This repeats until the end. You will need to change “Domain\account” to your domain and an account that has admin rights.  Also note, that Powershell does not have a pause function like cmd.exe does. The pause function was created after finding some examples from around the web. Enjoy!

 

$Cred = Get-Credential -credential Domain\account
$servgroup = “”

Function Pause ($Message = “Press any key to continue . . . “) {
If ($psISE) {
# The “ReadKey” functionality is not supported in Windows PowerShell ISE.
$alert = $servgroup + “Server Group Rebooting. Waiting 8 Minutes.”
$Shell = New-Object -ComObject “WScript.Shell”
$Button = $Shell.Popup($alert,480, “Servers Reboot, Script Paused”, 64)

Return
}

Write-Host -NoNewline $Message

$Ignore =
16, # Shift (left or right)
17, # Ctrl (left or right)
18, # Alt (left or right)
20, # Caps lock
91, # Windows key (left)
92, # Windows key (right)
93, # Menu key
144, # Num lock
145, # Scroll lock
166, # Back
167, # Forward
168, # Refresh
169, # Stop
170, # Search
171, # Favorites
172, # Start/Home
173, # Mute
174, # Volume Down
175, # Volume Up
176, # Next Track
177, # Previous Track
178, # Stop Media
179, # Play
180, # Mail
181, # Select Media
182, # Application 1
183 # Application 2

While ($KeyInfo.VirtualKeyCode -Eq $Null -Or $Ignore -Contains $KeyInfo.VirtualKeyCode) {
$KeyInfo = $Host.UI.RawUI.ReadKey(“NoEcho, IncludeKeyDown”)
}

Write-Host
}
restart-computer -computername (Get-Content C:\batch1.txt) -force -credential $Cred
$servgroup = “Batch1″

pause

restart-computer -computername (get-content C:\batch2.txt) -force -credential $Cred
restart-computer -computername (get-content c:\batch3.txt) -force -credential $cred
$servgroup = “Batch2 & Batch3 ”
pause
restart-computer -computername (get-content c:\batch4.txt) -force -credential $Cred
$servgroup = “Batch4 ”
pause

 

 

Windows Powershell

On 3/10/2012 I made a trip to Columbus Ohio for the First Microsoft Powershell Saturday. It was an “all day” event starting in the morning and finishing at 4 in the afternoon. Ed Wilson, Ashley McGlone and others put on some classes to show how to setup a profile, and work with different providers and interact with Active Directory. There were also sessions dealing with Exchange and WMI. It was very informative. I hope Ashley will post all of the code he presented, he showed how to use different command line tools and convert the output into more readable formats, as well as some very good scripts to parse Active directory objects. He also showed some very cool ways to find objects in the Active Directory Recycle Bin and then restore them. His script would even recursively restore deleted OUs. If you see this course offered in you region, take advantage of the class.

The Henry Ford 2011 Old Car Festival

E-readers, A review and my thoughts

For over a year I had wanted an e-book reader. Since I work with technology every day, having some way to carry around refernece materials in a small package is ideal.  Having computer manual after computer manual in a small device is prefered to carrying 40 pounds of books in a bag. In June 2010, Barnes and Noble reduced the cost of their nook. I ended up getting one with the 3G connection for my birthday. I decided on the nook for several reasons. I like that I can “side load” books from other publishers. I also like that I can download samples from Barnes and Noble to see if the book is what I am looking for. The device is simple to use and upgrade the storage on. Barnes and Noble have a fair selection of books on line for purchase. I would how ever like to see more nonfiction selections. I mostly read technical and nonfiction books. I also would like to see Barnes and Noble add some better free ebooks to their store. Many of the free books seem to be trashy romance or some such books. Having some high quality free books would be a great way to get people started when they have just purchased the nook.

The Nook’s screen is very clear and easy to read. The battery life is good, allowing me to read for several days if I turn off the WiFi and 3G. The touch screen for navigation is simple to use. The Web browser included  isn’t the greatest and lacks some abilities to reformat pages to fit on the Nook’s screen. But I didn’t get the nook for web browsing. A friens has the Nook Color, and is much better at web content.

I think e-readers in general are a great thing. If an e-reader can get people to read more, I am all for their use. I find that by and large too many do not read.  I have noticed that with the ease of checking online, I have read more samples of books.

The future of e-readers will be interesting. EInk is working on a color display but the prototype photos look like junk. If you want a touch screen, the Apple iPad is the best interface going. Pixel Qi has an interesting display technology, a LCD panel that can run in several modes and allows the screen to be easily read in daylight. A tablet made with a Pixel Qi display with multitouch and running Android as the OS would make a great device. Content for the e-readers is improving.

Nagios trademark problems

I have been using Nagios, the network monitoring software, for several years now. It is a shame to see that someone is trying to take advantage of the good work created by the Nagios community. Read the details here.

Multi-Touch Table

For the past while I have been looking at building some kind of multi-touch table. I you have used an iPhone, or the like you know what multi-touch is. What I would like to make is some something close to Microsoft’s Surface. NUI Group is a great site and forums. They have information for the creation of server types of multi-touch interfaces. After studying the site forums, and with what I have access to right now, I think I will be trying to build and LCD FTIR type display. When I get further I hope to post more details.

Pizza and Beer

So here is and interesting take on delivery pizza and beer.

The CrunchPad is dead

Well it turns out that after months of waiting that the CrunchPad is dead. It is a real shame as the pad looks like it could be a real winner for the tablet form factor. I hope some how they are able to bring it back to life, or that some one will be able to create a clone device.

Ubuntu turns 5, look back at what they have done

This past week Ubuntu Linux turned 5 years old. I have been using Ubuntu for about 3 years now. I feel it is important to look at what they have done for users, and how Ubuntu has changed the experience of Linux for the desktop.

First, Ubuntu releases new versions on a time based system. While Ubuntu is not the first distro to do this, they are fairly consistent, and they do not delay a release because they are waiting on some new feature in the kernel or some user space utility. Ubuntu really makes upgrades for this release schedule work well. Ubuntu releases twice a year. This means that you will have access to newer software in the repositories, and that you will enjoy the new enhancements to GNOME or KDE about every 6 months.

Second, Ubuntu really pioneered the use of the Live CD installer. Before Ubuntu it was very hard to try-before-you-buy. I spent hours installing, formatting, installing, wiping, installing before finding a distro that was easy to use, powerful, and simple to maintain. With Ubuntu’s Live CD new users can see if they like the interface, and if they do they can just click on the installer to have a new OS.

Third, Ubuntu has taken on the task of accessing proprietary drivers. if you network card requires a closed source driver, you can install it using the restricted driver module installer, and Ubuntu’s repos. It is much easier than hunting down each driver and guessing that you have all the needed parts to install it.

Fourth, Ubuntu has focused on usability, especially for desktop users. Ubuntu recruited professional programmers and designers. the developers have worked to stamp out bugs, and add features. All while not charging the end-user.

Lastly, Ubuntu has created a large community. If you are a new user, check out the wiki, or forums. You are bound to find answers to your questions. Ubuntu has worked hard at making users feel welcome. So these are just a few things Ubuntu has done over the past 5 year. It will be interesting to see what 5 more years bring. If you are a Ubuntu user what do you really like about Ubuntu? What are you looking forward to?

Pizza and Beer

So here is and interesting take on delivery pizza and beer. Maybe someone will come up with a bicycle and smoker combo. Or even a bicycle deep fryer could be cool.

Next Page »

Based on Fluidity