How to run the ClickOnce application (.appref-ms) on a remote computer?

I am trying to run a ClickOnce application using the .appref-ms shortcut on a remote machine using WMI, but cannot succeed. The code below works fine if I try to run notepad.exe.

ManagementPath pm = new ManagementPath(@"\\server\root\cimv2:Win32_process");
ManagementClass processClass = new ManagementClass(pm);

//Get an input parameters object for this method
ManagementBaseObject inParams = processClass.GetMethodParameters("Create");

//Fill in input parameter values
inParams["CommandLine"] = @"C:\Documents and Settings\Start Menu\Programs\New\New App.appref-ms";

//Execute the method
ManagementBaseObject outParams = processClass.InvokeMethod("Create", inParams, null);
+3
source share
2 answers

Try running the .appref-ms shortcut via rundll32:

inParams["CommandLine"] = @"rundll32.exe dfshim.dll,ShOpenVerbShortcut ""C:\New App.appref-ms"";

Alternatively, instead of relying on the shortcut path, you can use the application deployment URL (you can see it by opening the .appref-ms file in a text editor):

inParams["CommandLine"] = @"rundll32.exe dfshim.dll,ShOpenVerbApplication http://github-windows.s3.amazonaws.com/GitHub.application";

, Win32_Process.Create .

+2

, .

, , .

  • "" C:\Documents and Settings\ " " \StartMenu.
  • , , , . , , c:\program, .

, , , .

0

Source: https://habr.com/ru/post/1710131/


All Articles