Friday, May 15, 2009

Uninstall Products using VB script

The below lines are for VBS script file you can use to uninstall

1

strComputer = "."

2

Set objWMIService = GetObject("winmgmts:" _

3

& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

4

Set colSoftware = objWMIService.ExecQuery _

5

("SELECT * FROM Win32_Product WHERE Vendor = 'Hewlett-Packard'")

6

For Each objSoftware in colSoftware

7

objSoftware.Uninstall()

8

Next

in Line 1 you define variable called strComputer which is the computer you would like to execute this script against, in this case the value is “.” so this means localhost (locally)

Line 2 is to define Variable named objWMIService and to call WMI functions which is defined by winmgmts:

in the background the system loads Wbemdisp.dll which contains the Scripting Library functions

In VBS script they always split the functions in multiple lines although it can be used as one line, anyway

Line 3 which privilege level will be used in access the WMI

impersonationLevel=impersonate then the computer we are connecting to  which is strComputer  variable then the WMI class location "\root\cimv2”

Line 4 and 5 is one line but we use _ underscore to allow go to the next line (something like escape character) line 4 we define variable to contain the previously called data plus the function we are interested to call like query the WMI we use ExecQuery function. in line 5 we type our WMI QUERY Language where we select all columns available in class name win32_product and for not displaying all product we can filer the data by using  certain colmn value like name of the product or vendor

SELECT * FROM Win32_Product WHERE Vendor = 'Hewlett-Packard'

 

I have to sleep now

lets continue tomorrow

Upgrade from the Windows 7 beta to the Release Candidate

Source:http://windowsitpro.com/

Q. How do I upgrade from the Windows 7 beta to the Release Candidate?

A. There's no officially supported way to upgrade from the beta of Windows 7 (build 7000) to the Windows 7 Release Candidate (build 7100). Microsoft developers wanted to focus on the common end user upgrade experience, which will be from Windows Vista to Windows 7, and didn't want to waste cycles on getting a perfect upgrade experience from a beta. It is also expected that there will be no direct upgrade from the Release Candidate to the final release.

The Windows 7 RC is an early version of Windows 7 that we share with people who test it and send us feedback.

There is, however, a way you can do an in-place upgrade. This method will probably also work for an upgrade from RC to final.

  • Copy the contents of the Windows 7 RC to your local hard disk.
  • Access the Source directory within the copied Windows 7 RC location.
  • Open cversion.ini in Notepad.
  • Change the MinClient value from 7100 to 7000, as shown here:

[HostBuild]

MinClient=7000

MinServer=7000

  • Save the file.
  • You'll now be able to perform an in-place upgrade from the beta to the RC.

Uninstall Products using Powershell

I am trying to uninstall a product I have recently added to my Windows and i tried to access the normal way of uninstallation

which you can go Control Panel\Programs\Programs and Features

image

The problem is that the product I am trying to uninstall is not displayed there, although the product is available in the start menu

image

So I will use Powershell and WMI to uninstall it

gwmi win32_product

image

gwmi win32_product -filter "name='HP ProtectTools Security Manager'"

image

now I will try to find what is the available methods that we can use with this class

I can write gwmi win32_product -filter "name='HP ProtectTools Security Manager'" |gm or gwmi win32_product |gm

image

to call a method you have attach your command to a variable then call the varable.method()

to attach it to variable type $varname=the command

$product=gwmi win32_product -filter "name='HP ProtectTools Security Manager'"

Now we can attach Uninstall method to the variable

$product.uninstall()

this should work fine but as I am tring this example on Windows 7 it gave me return value of 1603 it means some thing that is not 0 (normal exit)

image

I investigated the problem and I found as usual the application is running under non elevated privilege I should select Run as Administrator.

image

I did so and I tried the command again and it gave me return value of Zero.

image

Article Code

1 $product=get-wmiobject win32_product -filter "Vendor='Hewlett-Packard'"
2 $product.uninstall()

Saturday, May 9, 2009

Adding Microsoft Virtual Server to VMM

In this article I am just adding step by step guide on how to add Microsoft Virtual Server 2005 R2 to System Center Virtual Machine Manager 2008 ( the snapshot are from VMM 2008 R2)

From the VMM Admin Console select Add Host from the Action Menu/Pane

 

image

image

image

image

image

image

image

$Credential = get-credential
$VMHostGroup = Get-VMHostGroup -VMMServer localhost | where {$_.Path -eq "All Hosts\Class D"}

Add-VMHost -VMMServer localhost -ComputerName "virtualserver12.omsdemo.oms" -Description "" -Credential $Credential -RemoteConnectEnabled $true -VmPaths "C:\SystemCenter" -Reassociate $false -RunAsynchronously -RemoteConnectPort 5900 -VMHostGroup $VMHostGroup

It May fail if your did not have all the prerequisites

1- Microsoft Virtual Server R2 SP1

2- Certain patch for VS  KB948515.msp

3- The BITS service should not be disabled

4- WS-Management is installed and started.

image

image

or It will success with the below screen.

image

 

Additional Snapshots for adding multiple servers at the same time

image

image

and here below the script

$Credential = get-credential
$VMHostGroup = Get-VMHostGroup -VMMServer localhost | where {$_.Path -eq "All Hosts\Class D"}

Add-VMHost -VMMServer localhost -ComputerName "virtualserver6.omsdemo.oms" -Description "" -Credential $Credential -RemoteConnectEnabled $true -VmPaths "D:\SystemCenter" -Reassociate $false -RunAsynchronously -RemoteConnectPort 5900 -VMHostGroup $VMHostGroup

$Credential = get-credential
$VMHostGroup = Get-VMHostGroup -VMMServer localhost | where {$_.Path -eq "All Hosts\Class D"}

Add-VMHost -VMMServer localhost -ComputerName "virtalserver7.omsdemo.oms" -Description "" -Credential $Credential -RemoteConnectEnabled $true -VmPaths "D:\SystemCenter" -Reassociate $false -RunAsynchronously -RemoteConnectPort 5900 -VMHostGroup $VMHostGroup

$Credential = get-credential
$VMHostGroup = Get-VMHostGroup -VMMServer localhost | where {$_.Path -eq "All Hosts\Class D"}

Add-VMHost -VMMServer localhost -ComputerName "virtualserver9.omsdemo.oms" -Description "" -Credential $Credential -RemoteConnectEnabled $true -VmPaths "D:\SystemCenter" -Reassociate $false -RunAsynchronously -RemoteConnectPort 5900 -VMHostGroup $VMHostGroup

$Credential = get-credential
$VMHostGroup = Get-VMHostGroup -VMMServer localhost | where {$_.Path -eq "All Hosts\Class D"}

Add-VMHost -VMMServer localhost -ComputerName "virtualserver10.omsdemo.oms" -Description "" -Credential $Credential -RemoteConnectEnabled $true -VmPaths "D:\SystemCenter" -Reassociate $false -RunAsynchronously -RemoteConnectPort 5900 -VMHostGroup $VMHostGroup

$Credential = get-credential
$VMHostGroup = Get-VMHostGroup -VMMServer localhost | where {$_.Path -eq "All Hosts\Class D"}

Add-VMHost -VMMServer localhost -ComputerName "virtualserver11.omsdemo.oms" -Description "" -Credential $Credential -RemoteConnectEnabled $true -VmPaths "D:\SystemCenter" -Reassociate $false -RunAsynchronously -RemoteConnectPort 5900 -VMHostGroup $VMHostGroup

Free 4 GB by Moving the Page file

I have Dual boot person I have Windows 7 and Windows Server 2008 r2.

I am running Hyper-V on Windows Server 2008 r2, and I always need more disk space in the Windows Server 2008 r2 drive.

I remember one old trick which is moving the page file to one partition for both OSs

Open System Properties

 

image

Select Advanced System Settings and Select Advanced Tab then under Performance Select Settings image

Select Advanced, under Virtual memory select Change

image

Uncheck Automatic manage page file size for all drives.

image

image

Select Drive C where you Installed your second OS and select System managed size.

Select Drive D where your current OS is installed and select No paging file.

image 

I have now 4 GB free on Drive D: I am really happy.

Friday, May 8, 2009

Top Issues for Microsoft Support for Windows Server 2008 Hyper-V (Q2)

Top Issues for Microsoft Support for Windows Server 2008 Hyper-V (Q2)

 

It is time to update everyone on the types of issues our support engineers have been seeing for Hyper-V. The issues are categorized below with the top issue(s) in each category listed with possible resolutions and additional comments as needed. I think you will notice that the issues for Q2 have not changed much from Q1. Hopefully, the more people read our updates, the fewer occurrences we will see for some of these and eventually they will disappear altogether.

Deployment\Planning

Issue #1

Customers looking for Hyper-V documentation

Resolution: Information is provided on the Hyper-V TechNet Library which includes links to several Product Team blogs. Additionally, the Microsoft Virtualization site contains information that can be used to get a Hyper-V based solution up and running quickly.

Installation Issues

Issue #1

After the Hyper-V role is installed, the customer creates a virtual machine, but it fails to start with the following error:

The virtual machine could not be started because the hypervisor is not running.

Cause: Hardware virtualization or DEP was disabled in the BIOS.

Resolution: Enable Hardware virtualization or DEP in the BIOS. In some cases, the server needs to be physically shutdown in order for the new BIOS settings to take effect.

Issue #2

System hangs on restart at "Configuring Updates Stage 3 of 3" after the Hyper-V role is enabled, disabled, or updated.

Cause: This issue can be caused by the HP Network Configuration utility.

Resolution: Perform the steps documented in KB950792.

Issue #3

Customer was experiencing an issue on a pre-release version of Hyper-V.

Resolution: Upgrade to the release version (KB950050) of Hyper-V.

Virtual Devices\Drivers

Issue #1

Synthetic NIC was listed as an unknown device in device manager.

Cause: Integration Components need to be installed.

Resolution: Install the Integration Services by opening the Virtual Machine Connection window, and then select Insert Integration Services Setup Disk on the Action menu.

Issue #2

Stop 0x0000001A on a Microsoft Hyper-V Server 2008 or Server 2008 system with the Hyper-V role installed.

Cause: Vid.sys driver issue.

Resolution: Install hotfix KB957967 to address this issue.

Issue #3

Stop 0x00000050 on a Microsoft Hyper-V Server 2008 or Server 2008 system with the Hyper-V role installed.

Cause: Storvsp.sys driver issue.

Resolution: If a VM has a SCSI controller with no disks attached, this bugcheck can occur. The resolution is to remove any SCSI controllers which don’t have disks attached. This issue is fixed in SP2.

Issue #4

After you move a Windows Vista or Windows Server 2008 virtual machine from Virtual PC or Virtual Server, the Vmbus device fails to load. When you check the properties of the device in device manager, the device status displays one of the following messages:

This device cannot find enough free resources that it can use. (Code 12).

This device cannot start. (Code 10).

Cause: This issue occurs because the Windows Vista or Windows Server 2008 virtual machine is using the incorrect HAL.

Resolution: Perform the steps documented in KB954282.

Issue #5

Unable to associate the virtual COM port to a physical COM port.

Cause: By design (documented in the help file).


Snapshots

Issue #1

Snapshots were lost

Cause: Parent VHD was expanded. If snapshots are associated with a virtual hard disk, the parent vhd file should never be expanded. This is documented in the Edit Disk wizard:

clip_image002

Resolution: Restore data from backup.

Issue #2

Snapshots were deleted.

Cause: The most common cause is that the customer deleted the .avhd files to reclaim disk space (not realizing that the .avhd files were the snapshots).

Resolution: Restore data from backup.

Integration Components

Issue #1

A Windows 2000 (SP4) virtual machine with the Integration Components installed may shut down slowly.

Cause: This problem is caused by a bug in the operating system (outside of Hyper-V).

Resolution: KB959781 documents the workarounds for this issue on Server 2008. The issue is fixed in Windows Server 2008 R2.

Issue #2

Attempting to install the Integration Components on a Server 2003 virtual machine fails with the following error:

Unsupported Guest OS

An error has occurred:  The specified program requires a newer version of Windows.

Cause: The most common cause is that Service Pack 2 for Server 2003 wasn’t installed in the virtual machine..

Resolution: Install SP2 in the Server 2003 VM before you install the integration components.

Virtual machine State and Settings

Issue #1

You may experience one of the following issues on a Windows Server 2008 system with the Hyper-V role installed or Microsoft Hyper-V Server 2008:

When you attempt to create or start a virtual machine, you receive one of the following errors:

  • The requested operation cannot be performed on a file with a user-mapped section open. ( 0x800704C8 )
  • ‘VMName’ Microsoft Synthetic Ethernet Port (Instance ID {7E0DA81A-A7B4-4DFD-869F-37002C36D816}): Failed to Power On with Error 'The specified network resource or device is no longer available.' (0x80070037).
  • The I/O operation has been aborted because of either a thread exit or an application request. (0x800703E3)

Virtual machines disappear from the Hyper-V Management Console.

Cause: This issue can be caused by antivirus software that is installed in the parent partition and the real-time scanning component is configured to monitor the Hyper-V virtual machine files.

Resolution: Perform the steps documented in KB961804.

Issue #2

Creating or starting a virtual machine fails with the following error:

General access denied error' (0x80070005)

Cause: This issue can be caused by the Intel IPMI driver.

Resolution: Perform the steps documented on Intel’s site.

High Availability (Failover Clustering)

Issue #1

How to configure Hyper-V on a Failover Cluster.

Resolution: A step-by-step guide is now available which covers how to configure Hyper-V on a Failover Cluster.

Issue #2

Virtual machine settings that are changed on one node in a Failover Cluster are not present when the VM is moved to another node.

Cause: The "Refresh virtual machine configuration" option was not used before attempting a failover.

Resolution: When virtual machine settings are changed on a VM that’s on a Failover Cluster, you must select the refresh virtual machine configuration option before the VM is moved to another node. There is a blog that discusses this.

Backup (Hyper-V VSS Writer)

Issue #1

You may experience one of the following symptoms if you try to backup a Hyper-V virtual machine:

· If you back up a Hyper-V virtual machine that has multiple volumes, the backup may fail. If you check the VMMS event log after the backup failure occurs, the following event is logged:

Log Name: Microsoft-Windows-Hyper-V-VMMS-Admin

Source: Microsoft-Windows-Hyper-V-VMMS

Event ID: 10104

Level: Error

Description:

Failed to revert to VSS snapshot on one or more virtual hard disks of the virtual machine '%1'. (Virtual machine ID %2)

· The Microsoft Hyper-V VSS Writer may enter an unstable state if a backup of the Hyper-V virtual machine fails. If you run the vssadmin list writers command, the Microsoft Hyper-V VSS Writer is not listed. To return the Microsoft Hyper-V VSS Writer to a stable state, the Hyper-V Virtual Machine Management service must be restarted.

Resolution: An update (KB959962) is now available to address issues with backing up and restoring Hyper-V virtual machines.

Virtual Network Manager

Issue #1

How to configure a virtual machine to use a VLAN.

Resolution: VLANs are discussed in the following blogs: http://blogs.msdn.com/virtual_pc_guy/archive/2008/03/10/vlan-settings-and-hyper-v.aspx and http://blogs.msdn.com/adamfazio/archive/2008/11/14/understanding-hyper-v-vlans.aspx

Hyper-V Management Console

Issue #1

How to manage Hyper-V remotely.

Resolution: The steps to configure remote administration of Hyper-V are covered in a TechNet article. John Howard also has a very thorough blog on remote administration.

As always, we hope this has been informative for you.

Chuck Timon
Senior Support Escalation Engineer
Microsoft Enterprise Platforms Support

Tuesday, May 5, 2009

Virtual Windows XP – Windows 7 XP mode

I was searching for what is Windows 7 XP mode? I found it was published in Microsoft Technet under the name of Windows Virtual PC http://technet.microsoft.com/en-us/subscriptions/downloads/default.aspx?pv=36:350

I am just testing Windows 7 XP mode which allow you to run Windows XP SP3 under Windows 7 to have full backward compatibility.

the download consists of two files one is Windows Virtual PC Beta (x64) windows_virtual_pc_beta_x64_343649.msu and the other file is Windows XP image (something like syspreped) under the name of windows_virtual_pc_beta_x64_343649.exe

Here below the Installation steps:

Step 1: Executing the first file windows_virtual_pc_beta_x64_343649.msu

image

It updates the windows as the new Windows Virtual PC looks like an update not a separate application something like Windows Vista Ultimate Games and features.

image

Here below some of the EULA for

image

installation in Progress is is just 2 to 3 minutes

image

image

image

Restart you machine to apply the new update.

Step 2: is to install the VHD for Windows XP windows_virtual_pc_beta_x64_343649.exe

image

 

image

image

image

Installation Successful.

 

Now lets start the Windows XP mode.

We have now as below Windows Virtual PC application folder Where there is a ready created “Virtual Windows XP” and Virtual Machines folder which actually is the Windows Virtual PC application in the format of Windows Vista Explorer.

image

so, lets start Virtual Windows XP

image

you have to accept the EULA as this is a complete working Windows XP.

image

Specify your credentials.

image

Windows Updates

image

Now it seems like it updates the Syspreped Image as I think with Entered information

image

Here we go a full functional Windows XP so we can run any XP applications without compatibility problems.

image 

It is Windows XP SP 3

image

Here, lets have a look for the menu options.

image

1- Action Menu

View Full Screen

Sleep ---> Save state like Virtual PC

Restart

image

2- USB Menu

Attach your USB devices

image

3- Tools Menu

Disable Integration Features –> like VM additions in Virtual PC

image

4- Ctrl+ Alt+ Del is done by this menu item or Ctrl + Alt + End like remote desktop and Hyper-V

In the start Menu there is Virtual Machines which you can see the status of your Virtual Windows XP, modify settings or create your own Virtual Machines.

image

You can get the setting for your Windows XP by right click the Virtual Windows XP select Settings.

image

Windows XP Mode allow you to change settings like (memory  enable undo disks)assigned to your VM

Also allows you to create another VM by Click on Create virtual machine on the bar like below.

image

Specify a name and location for this virtual machine.

image

Specify memory and networking options.

image

Add a virtual hard disk.

 

image

You can create another copy of your VHD disk by creating difference disk of the downloaded VHD

image

Now you have a new VM. 

image

Lets start it,

Oops, as I did specify an empty disk, It will try to boot from network “PXE enabled”. this will be nice in other tests.

image

Lets shutdown it.

image

I wish you have enjoyed!!! see you soon in another blog.