SHARE
TWEET

Start Metro IE from powershell

a guest Oct 1st, 2014 9,529 Never
  1.  
  2. $code = @"
  3. using System;
  4. using System.Runtime.CompilerServices;
  5. using System.Runtime.InteropServices;
  6. namespace Win8 {
  7.    
  8.    [ComImport, Guid("2e941141-7f97-4756-ba1d-9decde894a3d"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
  9.    interface IApplicationActivationManager
  10.    {
  11.        IntPtr ActivateApplication([In] String appUserModelId, [In] String arguments, [In] UInt32 options, [Out] out UInt32 processId);
  12.    }
  13.  
  14. [ComImport, Guid("45BA127D-10A8-46EA-8AB7-56EA9078943C")]//Application Activation Manager
  15.    public class ApplicationActivationManager : IApplicationActivationManager
  16.    {
  17.        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)/*, PreserveSig*/]
  18.        public extern IntPtr ActivateApplication([In] String appUserModelId, [In] String arguments, [In] UInt32 options, [Out] out UInt32 processId);
  19.        
  20.    }
  21.    
  22. }
  23. "@
  24.  
  25. add-type -TypeDefinition $code
  26. $appman = new-object Win8.ApplicationActivationManager
  27.  
  28. $appman.ActivateApplication("DefaultBrowser_NOPUBLISHERID!Microsoft.InternetExplorer.Default",$null,0,[ref]0)
RAW Paste Data
Top