Problem when trying to run a .msi file


because there new .msi packages have downloaded , replaced old 1 (and have different version names) wanted keep easy possible user mustn't rename file specific name that script won't break.

the problem is, tried wildcard. however, in every .msi installation recieve 123 returnvalue , seems not having found file. in .exe installations works fine no errors although, both .ps1 files close identical. post lines changed of script, didn't work anymore .msi files:

working unique name:

$install = join-path ($config.installer.globalsettings.nasdrive) "/7 zip/7zip.msi"

see above: long replaced .msi package renamed "7zip", script works, can annoying lazy users, tried pick .msi file in there (since one).

not working wildcard:

$install = join-path ($config.installer.globalsettings.nasdrive) "/7 zip/*.msi"

remember, line .exe file looks same (only using .exe instead of .msi @ end) it's confusing me, why doesn't work .msi files aswell.

i think there many people can figure out issue, can't.


the following signature:

powershell programmer & advanced lua programmer

location: switzerland

beside that, whenever see reply, think helpful, click "vote helpful"! , whenever see reply being answer main question of thread, click "mark answer" (if opened thread).

i published url's icons in signature.

please contact me, before reporting me, thank you.

need links images codeblock? go here.

ah…
think guess, starting number in .msi name fault, wrong!
if use star in join-path star got not expanded!
wmi class cannot handle joker chars (placeholders) in path!

try :

# 1 .msi in folder use this: $install = get-item (join-path ($config.installer.globalsettings.nasdrive) "/7 zip/*.msi") $product= [wmiclass]"\\.\root\cimv2:win32_product" $product.install($install.fullname,"addlocal=all",$true)  # if there more 1 .msi process in folder, use this: $msipackages = get-childitem (join-path ($config.installer.globalsettings.nasdrive) "/7 zip") -filter "*.msi" foreach($msipackage in $msipackages) { 	$product= [wmiclass]"\\.\root\cimv2:win32_product" 	$product.install($msipackage.fullname,"addlocal=all",$true) }

suggestions:
1. never use spaces in folder or file names lead hard finding errors (if forgot provide quotation marks)
2. can use msiexec.exe install .msi packages  msiexec.exe provides more parameter you!
enter following command see msiexec parameters :
msiexec.exe /?

http://lmgtfy.com/?q=powershell+msiexec.exe


please click “mark answer” if post answers question , click “vote helpful” if post helps you.
bitte markiere hilfreiche beiträge von mir als “als hilfreich bewerten” und beiträge die deine frage ganz oder teilweise beantwortet haben als “als antwort markieren”.
powershell blog http://www.admin-source.info
[string](0..21|%{[char][int]([int]("{0:d}" -f 0x28)+('755964655967-86965747271757624-8796158066061').substring(($_*2),2))})-replace' '
german ? come german powershell forum!



Windows Server  >  Windows PowerShell



Comments

Popular posts from this blog

Error: 0x80073701 when trying to add Print Services Role in Windows 2012 Standard

Disconnecting from a Windows Server 2012 R2 file sharing session on a Windows 7,8,10 machine

Windows 2016 RDS event 1306 Connection Broker Client failed to redirect the user... Error: NULL