3

This is a shortcut target of an application I launch from Windows 7 that starts a program in Windows XP Mode.

%SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\VMCPropertyHandler.dll,LaunchVMSal "Windows XP Mode" "||fc9407e9" "wIntegrate"

I can't seem to get the PS Start-process command to work for that target.

Code I use:

Start-Process %SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\VMCPropertyHandler.dll,LaunchVMSal "Windows XP Mode" "||fc9407e9" "wIntegrate"

Here is the error I receive:

Start-Process : A positional parameter cannot be found that accepts argument 'Windows XP Mode'.
At C:\Users\username.domain\Desktop\rebootpick.ps1:13 char:14
+ Start-Process <<<<  %SystemRoot%\system32\rundll32.exe %SystemRoot%\system32\VMCPropertyHandler.dll,LaunchVMSal "Windows XP Mode" "||fc9407e9" "wIntegrate"
    + CategoryInfo          : InvalidArgument: (:) [Start-Process], ParameterBindingException
    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.StartProcessCommand

Has anyone had any luck executing Windows XP Mode applications from Powershell from Windows 7?

2
  • Can you include the actual PS code you are using to launch it? Jan 23, 2012 at 20:26
  • Added, see question.
    – payling
    Jan 23, 2012 at 20:30

1 Answer 1

5

This should do it for you:

$sysRoot = get-content env:systemroot;
Start-Process $sysRoot\system32\rundll32.exe -ArgumentList "$sysRoot\system32\VMCPropertyHandler.dll,LaunchVMSal `"Windows XP Mode`" `"||fc9407e9`" `"wIntegrate`"";
Remove-Variable sysRoot;

First trick: %systemroot% doesn't work in PS, so we assign a variable ($sysRoot) to get that environment variable in PS.

The next trick is realizing there is only one argument provided to RunDLL32, and that argument has arguments. So we need to enclose all the parts of the argument into one argument using quotes. But we need to keep the existing quotes in that argument, so we escape them with `.

Hope that helps...

1
  • Works like a charm, thanks! Any idea what "||fc9407e9`" means? Is it just some random application id? Ideally I'd like to apply this script to multiple computers but if the string is different on every computer...
    – payling
    Jan 24, 2012 at 13:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .