Powershell, WmiObject and a corrupt repository

For Windows Vista, Windows 7, Windows Server 2008, and Windows Server 2008 R2, you can run winmgmt /verifyrepository from a command prompt. For Older OS like Windows XP and Windows Server 2003 run: WmiDiag tool with the checkconsistency option. For example: WmiDiag checkconsistency

If repository is found to be inconsistent, for Vista and newer, run from elevated command prompt:
Winmgmt /salvagerepository

Note this command will take the content of the inconsistent repository and merge it into the rebuilt repository if it is readable

If the above doesn’t work, then run:
Winmgmt /resetrepository

Note this will reset repository to the initial state when the OS was first installed


Change the time zone in Windows 7

By default, the time zone in Windows 7 is set to  -8:00 Pacific Time (US & Canada). There are multiple ways to change the time zone. This post shows you two ways to change the time zone in Windows 7.

Solution 1:

  1. Right click on the clock, at the right bottom of your screen, and click on Adjust Date/Time.
  2. Click on the Change time zone button
  3. Select the correct time zone and click OK. If you are in a region with DST, make sure you have checked the “Automatically adjust clock for Daylight Saving Time” checkbox.

Solution 2:

  1. Click the Windows Orb and type “cmd” in de Search box. Press Enter.
  2. Type TZUTIL /L and press Enter. TZUTIL is a tool in Windows 7 which lets you set the time zone from the command line.
  3. From the output of the command TZUTIL /L (which is quite a long list 🙂 ), record the time zone you want to change to.
  4. Type TZUTIL /S “time zone . So, in case you want to change the time zone to (UTC+01:00) Amsterdam, Berlin, Bern, Rome, Stockholm, Vienna, you should type:  TZUTIL /S “W. Europe Standard Time”.

For more information about TZUTIL, just type TZUTIL and press Enter.

Using PowerShell as the Shell on Windows Server Core

With PowerShell becoming one of the most important tools in a Windows administrator’s tool bag as well as really becoming the best prompt to use on Windows Server Core, I thought it was about time I documented how to change the command prompt that opens when you log into Server Core with a PowerShell prompt.

To complete this requires two steps:

  1. Enable/Install PowerShell on the Windows 2008 R2 Server Core computer
  2. Update the HKLMSoftwareMicrosoftWindows NTCurrentVersionWinLogonShell registry key replacing cmd.exe with PowerShell.exe

To enable PowerShell run SCONFIG from the command prompt and then select menu options 4 then 2. This will require the computer to be rebooted

Once rebooted login and in the CMD prompt type PowerShell. At the PowerShell prompt type:


Having completed above log off and back on and a powershell prompt will open instead.


How to Use Nslookup to Verify MX record configuration

As I have been installing, configuring, and testing our Microsoft Exchange Server I have had to test the DNS system to ensure our domain is registared and working properly. This is something that all system administrators should know how to do, but the exact syntax is often forgotten.
This operation can be done on Windows 7 and Windows Server 2003/2008 R2. There are similar options if you are doing this from Linux.

  1. Open a Command Prompt (Start, Run, cmd, [Enter])
  2. Type nslookup.
  3. Server (The DNS server that you want to use. This is optional.)
  4. Set q=mx (This sets the query type to “MX” {Mail Exchanger}.)
  5. (The domain name you want to lookup the mail exchanger to.)


Windows Update WUAUCLT Command Line Switches

The command line switches to WUAUCLT — the Windows Update Automatic Updates client — are documented, just not very coherently. There’s quite a few of them, but the only ones I need regularly are the ones to force update checks. They work with Windows 2000 Server and Windows Server 2003, though they make work on other versions.

Continue reading Windows Update WUAUCLT Command Line Switches

Sign your .rdp file

Hi all,

You can use a digital signature to sign .rdp files. When you sign rdp files with trusted certificates, your clients can verify that important settings such as which server to connect to haven’t changed since the creation of the rdp file.
This enables clients to recognize your organization as the source of the RemoteApp program or the remote desktop connection, and allows them to make more informed trust decisions about whether to start the connection.

So what do you have to do to sign a .rdp file?

First: Create your .rdp file

Second: Get your certificate’s thumbprint

Third: Sign your .rdp file by using rdpsign.exe

Continue reading Sign your .rdp file

DC Rename command line

Here I will explain how you can change your DC name trough command line:

start CMD as administrator and enter this command:

[shell]netdom computername %computername% /add:newcomputername.domain.local[/shell]

To make the new computer name the primary computer name you must enter the next command:

[shell]netdom computername %computername% /makeprimary:ewcomputername.domain.local[/shell]

now we must reboot the server:

[shell]shutdown /r /t 0[/shell]

after reboot we must remove the old computername:

[shell]netdom computername %computername% /remove:oldcomputername.domain.local[/shell]

that’s all that you need to do