Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

share|improve this question
    
Can you include the actual PS code you are using to launch it? –  Ƭᴇcʜιᴇ007 Jan 23 '12 at 20:26
    
Added, see question. –  payling Jan 23 '12 at 20:30

1 Answer 1

up vote 5 down vote accepted

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...

share|improve this answer
    
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 '12 at 13:12

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.