Category Archives: Windows Scripts

Sample Script to manage Windows

Powershell: Check for Administrator rights

Hi,

for a lot of powershell scripts Administrator permissions are necessary. In powershell, you can check if you are elevated by the following script code.
Insert the snippet at the top of your script. It checks the credentials and exits the script if the administrator permissions are missing.
Continue reading Powershell: Check for Administrator rights

Windows: Read the IP Address of a BMC Board

Most of the Serversystems have a Baseboard Management Controller (BMC) integrated for maintenace and management tasks.

Typical functions are, indepentend from the running operating system:

  • Shutdown and reboot
  • Switch Power On and Off
  • KVM (Keyboard, Video, Mouse) redirection
  • Hardware monitoring
  • USB redirection, connect the local DVD Drive to the Server over a LAN connection
  • and much more…

Usually, the BMC has its own LAN Interface and therefore an own IP Address.
Continue reading Windows: Read the IP Address of a BMC Board

Powershell: Active Directory Domain Operations

Hi,

some commands to manage Active Directory Domain Controllers by using the .NET System.DirectoryServices.ActiveDirectory.Domain Class.
Load the assembly

[reflection.assembly]::LoadWithPartialName("System.DirectoryServices.Protocols")|Out-Null

Get a Domain Object with the logon Domain of the current user
Continue reading Powershell: Active Directory Domain Operations

Powershell: How to show a message box

Sometimes while a powershell script is running you want to show a MessageBox with a information or warning to the user. In Windows Powershell no Commandlet exists to show a Message Box.

Nevertheless it is possible by using the .NET Windows.Forms.MessageBox class:-).

First of all load the assembly.

# Load assembly
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")

To show the messagebox call the static function show(“Message Text”)
Continue reading Powershell: How to show a message box

Windows: Disable automatic Window arranging and resizing while dragging with the mouse (AeroSnap)

Sometimes the Windows 7 functionality to automatically arrange or resize a window while dragging is a pain. This feature is called Aero Snap. Here are good news, you can disable the behaviour :-).

Open the Control Panel, go to “Ease of Access center”. If you are there, click “Make the mouse easier to use” and enable “Prevent Windows from being automatically arranged when moved to the edge of the screen”.

Mouse Settings

Continue reading Windows: Disable automatic Window arranging and resizing while dragging with the mouse (AeroSnap)