Category Archives: IT Toolkit

Essential IT tools and utilities I use every day.

Remotely managing disks on Windows 2008/Hyper-V Server R2

As I’m mooting some hardware upgrades to my bash’n’crash Hyper-V server, I wanted to check out a few things with regards to it’s performance and general health.  I duly fired up Server Manager, but was thwarted when I tried to use Disk Management and got the message of RPC Server is unavailable.  I checked the Firewall, and the requisite rules (see below) were enabled.  I recycled the Virtual Disk Service and still had no luck.

After hunting around a while I found a Technet Forum post that covered this.  You have to enable the necessary inbound rules both on the server being managed and the managing computer.  Once I had done this, and restarted Server Manager, I could access Disk Management.

For reference, the two rules that need to be enabled are:

Remote Volume Management – Virtual Disk Service (RPC)

Remote Volume Management – Virtual Disk Service Loader (RPC)

As per the Technet post, I found that you don’t need the Remote Volume Management (RPC-EPMAP) rule enabled.  Needless to say, I only enabled both rules for the Domain firewall profile.

Automatically Loading PSHyperV Library

Late last year I wrote about getting the Powershell Management Library for Hyper-V (PSHyper-V) up and running on my Hyper-V installation. Although a newer version of the library was released in January, I simply hadn’t gotten around to updating my server.  If I’m honest, beyond the occasional restart following an update (or powercuts – thanks for nothing EDF Energy) all of the Hyper-V servers under my care tend to sit the corner and are generally forgotten about.  Far more attention is paid to the Virtual Machines than the actual host upon which they rely.

One change between the versions of PSHyperV has been the change from a standard script to a powershell module.  As I prefer for the library to be automatically loaded, this required a change to the user’s powershell profile.  The slight fly in the ointment is that I had forgotten how to do this, so here is a quick reprise for my own memory.

1.  Open Powershell.  If you are within a command prompt, type cmd /c start powershell to open a new powershell window.

2.  In Powershell, type $profile.  This will get you the full path to where your profile is stored.  Your profile is a powershell script that executes whenever a Powershell prompt is opened.  The profile will look something liek this:

C:\Users\<your username>\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

3.  Your profile file may or may not exist.  If you have not already used it elsewhere, the chances are that it doesn’t.  To create a new profile file, enter new-item $profile -itemtype file -force in Powershell.

4.  Now open the profile file.  If you are using Server Core or Hyper Server R2, you can still use Notepad (it is present, but missing a few features).  So enter notepad $profile in Powershell.

5.  Within Notepad, enter the Import-Module command for PSHyperV.  If you install PSHyperV using the supplied install.cmd, this path should be like

Import-Module “c:\Program Files\modules\hyperv\hyperv.psd1”

6.  Once done, save the file and exit Notepad.

7.  To test, open a new Powershell prompt and type Get-VM.  If everything has gone as planned, you will get a list of all of the VMs present on your Hyper-V server.

This process will only work for the current logged on user.  If you have multiple user accounts on Hyper-V, you will need to repeat this process for all that require access.

Finally, if you have not already done so you will need to set the execution policy for Powershell.  I’ve found that all you require is RemoteSigned.  To set this, enter set-executionpolicy remotesigned within Powershell.

Powershell Tip #1
In Powershell, type $profile.

PS C:\Program Files\Microsoft\AxFuzzer> $profile
C:\Users\mengli\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

That points to where your profile is stored at.  This is a powershell script that executes upon the start up of any powershell prompt for the current user.  Go ahead and make the file.  In my case, I made a new file at the location by typing this:

new-item $profile -itemtype file -force

Now, open the file and you can put in things like this:
set-executionpolicy unrestricted
. \\meng\shared\powershell\hyperv.ps1
set-executionpolicy remotesigned

Every new powershell prompt that you

Getting System Information from the command line or Powershell

Although there are any number of tools available to gather and collate information regarding the configuration and composition of a computer, these are often overkill when all you wish to learn is one or more basic details like the processor type, memory, computer name etc.

A quick shortcut is to gather this information from the command line or Powershell.  Windows XP and later includes in the systeminfo utility. Typing this at the command prompt will produce information similar to this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
c:\systeminfo
Host Name:                 SOMEPC
OS Name:                   Microsoft Windows 7 Ultimate
OS Version:                6.1.7100 N/A Build 7100
OS Manufacturer:           Microsoft Corporation
OS Configuration:          Member Workstation
OS Build Type:             Multiprocessor Free
Registered Owner:          SomeOwner
Registered Organization:
Product ID:                00428-321-7001132-70186
Original Install Date:     04/05/2009, 10:29:33
System Boot Time:          28/09/2009, 13:50:08
System Manufacturer:       Dell Inc.
System Model:              Latitude D820
System Type:               X86-based PC
Processor(s):              1 Processor(s) Installed.
[01]: x86 Family 6 Model 14 Stepping 8 GenuineIntel ~2000 Mhz
BIOS Version:              Dell Inc. A09, 04/06/2008
Windows Directory:         C:\Windows
System Directory:          C:\Windows\system32
Boot Device:               \Device\HarddiskVolume2
System Locale:             en-gb;English (United Kingdom)
Input Locale:              en-gb;English (United Kingdom)
Time Zone:                 (UTC) Dublin, Edinburgh, Lisbon, London
Total Physical Memory:     3,326 MB
Available Physical Memory: 858 MB
Virtual Memory: Max Size:  8,313 MB
Virtual Memory: Available: 5,500 MB
Virtual Memory: In Use:    2,813 MB
Page File Location(s):     C:\pagefile.sys
Domain:                    somedomain.lan
Logon Server:              \\SOMEDC
Hotfix(s):                 4 Hotfix(s) Installed.
[01]: KB958830
[02]: KB969497
[03]: KB970789
[04]: KB970858
Network Card(s):           3 NIC(s) Installed.
[01]: Intel(R) PRO/Wireless 3945ABG Network Connection
Connection Name: Wireless Network Connection
DHCP Enabled:    Yes
DHCP Server:     10.10.0.1
IP address(es)
[01]: 10.10.0.100
[02]: fe80::901:8ac7:5a6b:1f56
[02]: Broadcom NetXtreme 57xx Gigabit Controller
Connection Name: Local Area Connection
Status:          Media disconnected

If you are using Powershell – if not, why not? – the get-wmiobject win32_computersystem command will return rudimentary details regarding the host PC.

1
2
3
4
5
6
7
PoSH>get-wmiobject win32_computersystem
Domain              : somedomain.lan
Manufacturer        : Dell Inc.
Model               : Latitude D820
Name                : SOMEPC
PrimaryOwnerName    : SomeOwner
TotalPhysicalMemory : 3487690752

Windows Task Scheduler Keyset does not exist Error

Task Scheduler is one of those great little components that once you set it, you tend to forget it. One of the Windows 2003 servers I tend has been running scheduled tasks flawlessly for over a year until they suddenly stopped one day. Every time I went to open/edit and individual task’s properties, a dialog with the following message appeared:

1
2
3
General page initialization failed.
The specific error is:0x80090016: Keyset does not exist
An error has occurred attempting to retrieve task account information. You may continue editing the task object, but will be unable to change task account information.

A solution to this problem is not readily apparent, more so after the ubiquitous net search returns results that relate to Windows 2000, not 2003. After some playing, and with reference to the MS KB article http://support.microsoft.com/default.aspx?scid=kb;en-us;246183, I got the Task Scheduler working again doing the following:

  1. Stop the Cryptographic service
  2. Delete the contents of the C:\Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\S-1-5-18 folder – as a precaution, I made a backup first.
  3. Start the Cryptographic service (a server restart may be required)
  4. Re-assign the Run As user account for every required scheduled task

Getting Powershell Management Library for Hyper-V (PSHyper-V) up and running

One of the great capabilities of Powershell is the ability to extend its’ functionality through new libraries. One I am currently playing with is the Powershell Management Library for Hyper-V, or PSHyper-V. For Server Core and Hyper-V Server users, the cmdlets contained within this library add a new dimension of functionality and capabilities, and enable admins to reduce their reliance on Hyper-V manager to perform otherwise simple tasks.

Although you can load the library upon demand, there is another method available whereby it may be preloaded as part of your windows profile.

  1. Download the latest recommended release of PSHyper-V from http://www.codeplex.com/PSHyperv
  2. Copy the contents of the ZIP archive onto your Hyper-V server. In my instance, these were to a folder called c:\powershell
  3. To get your profile path, type the following from with a Powershell prompt:
    1
    $profile

    You will typically get something like:

    1
    C:\Users\your_user_name\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
  4. The file Microsoft.PowerShell_profile.ps1 is the Powershell script that is executed upon the startup of any Powershell prompt for your user account. In most circumstances, this script doesn’t exist, so you will need to create it (it is worth checking first). To create the script, enter the following into a Powershell prompt
    1
    new-item $profile -itemtype file -force
  5. Now edit this file and add the path to PSHyper-V.ps1 into it. In my example, this is as follows:
    1
    . c:\powershell\PSHyper-V.psq

    Note the dot-space prior to the file path. This is required to execute the script.
    (Editing this file on server core or Hyper-V server can be a bit of trial. In the end, I did it remotely.)

  6. That’s it. To test it, either start a new Powershell prompt. If all is well, a list of the loaded PSHyper-V cmdlets will be shown.

Thanks to the author of the Technet blog post from which I have sourced most of the information for this.

Toolkit: Virtual CloneDrive

As someone who uses ISO files on an almost daily basis, a tool like SlySoft Virtual CloneDrive is a brilliant utility that allows the easy mounting of any ISO file as local disk drive.  I’ve used several similar utilities over the years, but this one is the best I’ve used yet.  It has been installed on a variety of PCs including my venerable Thinkpad, and I have yet to experience any problems.

Virtual CloneDrive is a free download available through the SlySoft website at http://www.slysoft.com/en/virtual-clonedrive.html.

As usual, you use Virtual CloneDrive at entirely your own risk.

Toolkit: Smart Defrag

Another near essential member of my IT Toolkit is the excellent free defragmenter tool, Smart Defrag.  Available either separately or as part of the IOBit Advanced SystemCase Suite, this tool has supplanted all of the other defragmenters I have previously used, and not just because of its’ price.  Over the years, I have been frustrated and equally annoyed by various defragmenter applications.  Either they ran slowly, or consumed vast amounts of system resources, either way they never seemed to pass the elementary test of “just work”.

For more details, head over to http://www.iobit.com/iobitsmartdefrag.html

Crapware and a (potential) helpful little tool: PC DeCrapifier

Configuring a new PC can always be a headache, especially when it has to be done completely by hand (i.e. no Ghosting or imaging).  As there are often a myriad of little changes that have to be done when configuring a PC manually, I have devised a checklist cum installation form that I follow.  This ensures that not only is the PC delivered up and running, but I also have a record of just what was done.

However, when I originally drew up these checklists I missed out the step labelled <i>Now spend one or more hours removing undesired pre-installed software (aka Crapware)</i>.  The chances are that if you get a new computer, it will come pre-loaded with a number of trial versions of software which you have to remove before you can install anything else.  Common trials are those of Norton Antivirus, McAfee or Microsoft Office 2007.  The latter can take a small ice age to remove.

I am pretty sure that I am not alone in my annoyance for the presumptiveness of the manufactures to install this software on new systems.  When I buy a new PC, especially one that is touted as being for businesses, I expect it to be delivered working (this helps, nothing makes me move suppliers quicker is a PC straight out of a box that doesn’t work), with the operating system pretty much ready to go and that’s it.  No trials, no please wait one hour while the OS installs all the required drivers.  Ready to go.

I had this recently with a new laptop.  It was supplied with Windows Vista, which was promptly downgraded to XP using the supplied media (manufacturers occasionally get something right).  The laptop flawlessly booted after the Windows XP installation and then presented me with a whole suite of crapware to remove.

Needeless to say, this did take some time.  What I could of done with then is a little tool I recently found whilst searching around for something completely different: The PC DeCrapifier.  This handy, free little utility removes all unwanted crapware for you.  Whilst I have not actually tested it yet, I have read a number of positive reports and it is definitely going into my IT Toolbox.  Once I get the opportunity to test it, I will post my comments.