c# - Remote running msiexec on Win32_Process -


the main task of short part computer name , install on pc needed software (throught msiexec.exe)

i

    {                                     credential creds = new credential();             userattr usercredential = new userattr();             usercredential = creds.defaultflagstest();                           connectionoptions connection = new connectionoptions();             connection.username = usercredential.username;             connection.password = usercredential.password;             connection.authentication = authenticationlevel.packetprivacy;              connection.authority = "ntlmdomain:tcc1";              managementscope scope = new managementscope(                 "\\\\"+computername+"\\root\\cimv2", connection);             scope.connect();              managementclass classinstance =                 new managementclass(scope,                 new managementpath("win32_process"), null);              managementbaseobject inparams = classinstance.getmethodparameters("create");              inparams["commandline"] = @"msiexec.exe /qb /m log.mif /i ""\\tcc1-pgh10.tcc1.local\swshare$\packages\netagent_10.0.3361\exec\kaspersky network agent.msi""";                     managementbaseobject outparams = classinstance.invokemethod("create", inparams, null);              int res = int.parse(outparams["returnvalue"].tostring());              if (res == 0)             {                 messagebox.show(outparams["returnvalue"].tostring(), "result");                                }             else throw new system.componentmodel.win32exception(res);                           close();                } 

the program returns 0, doesnt mean msiexec complete same success. error check path of package .. or smth. see in log file log.mif:

..............................
start attribute
name = "product"
id = 2
access = read-only
storage = specific
type = string(64)
value = "\tcc1-pgh10.tcc1.local\swshare$\packages\netagent_10.0.3361\exe"
end attribute
..............................

he crops name of package @ 64 symb. reason parametr commandline of win32_process.create has limit. don't know how overcome this...

win32_process.create has property currentdirectory, thath seems can solve propblem. can't process unc paths.

and can't install directory shorter. not right. (and can i've done this. , worked)

please, maybe know how solve propblem long installation path? different properties targetdir or installdir set path install, no from...

i gave up

start attribute  name = "product"  id = 2  access = read-only  storage = specific  type = string(64)  value = "\tcc1-pgh10.tcc1.local\swshare$\packages\netagent_10.0.3361\exe" end attribute 

the value limited 64symb including path. working on local machine without using unc paths


Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -