#189013 - 2008-08-04 03:24 PM
Installing an msi file with sanur.exe
|
xempa
Fresh Scripter
Registered: 2006-08-12
Posts: 37
|
Hi
I am trying to convert this batch file into kix any help here would be most appreciated. Despite best efforts I can't seem to get the syntax right
this werks perfectly as a batch file but any help would be appreciated
echo off runas /u:home\Administrator "msiexec /i \\PC01948\C$\Deployment\WBC.msi" | \\Pc01948\netlogon\scripts\sanur /i \\pc01948\netlogon\scripts\test.dat
many thanks
|
|
Top
|
|
|
|
#189019 - 2008-08-04 04:47 PM
Re: Installing an msi file with sanur.exe
[Re: xempa]
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
This should work for you.. Really, you could use SHELL or RUN to achieve the same result - just watch the quoting.
$FileHome = '\\PC01948\C$\Deployment\'
$ScriptHome = '\\pc01948\netlogon\scripts\'
SHELL '%comspec% /c runas /u:home\Administrator "msiexec /i '+$FileHome+'WBC.msi" | '+$ScriptHome+'sanur /i '+$ScriptHome+'test.dat'
Thanks,
Kent
Edited by Kdyer (2008-08-04 04:51 PM)
|
|
Top
|
|
|
|
#189021 - 2008-08-05 01:48 PM
Re: Installing an msi file with sanur.exe
[Re: xempa]
|
xempa
Fresh Scripter
Registered: 2006-08-12
Posts: 37
|
Hi Kyder
Many thanks for that I've made the following adjustments as per your suggestions and it works !. However I have a further situation where writeValue to the registry doesn't work for Domain users. I'm thinklng permissions but where ? Your's or anyone's help on this would be appreciated . many thanks
see code below
$FileHome = '\\PC01948\C$\Deployment\' $ScriptHome = '\\PC01948\netlogon\scripts\' $ScriptMSI = '\\PC01948\C$\Deployment\'
If NOT ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Updates','Waikaremoana') = 1 SHELL '%comspec% /c runas /u:home\Administrator "msiexec /i '+$ScriptMSI+'WBC.msi" | '+$ScriptHome+'sanur /i '+$ScriptHome+'test.dat' WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Updates','Waikaremoana','1','REG_DWORD') EndIf
$wmiColl = GetObject("WinMgmts:root/cimv2").ExecQuery("Select * FROM Win32_DesktopMonitor") For Each $wmiObj In $wmiColl Select Case $wmiObj.DeviceID = "DesktopMonitor1" $screenres1 = CSTR($wmiObj.ScreenWidth) + "x" + CSTR($wmiObj.ScreenHeight) Case $wmiObj.DeviceID = "DesktopMonitor2" $screenres2 = CSTR($wmiObj.ScreenWidth) + "x" + CSTR($wmiObj.ScreenHeight) EndSelect Next
select case $screenres1 = "1024x768" If NOT ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Updates','Sheild 1024x768') = 1 SHELL '%comspec% /c runas /u:home\Administrator "msiexec /i '+$ScriptMSI+'Shield1280.msi" | '+$ScriptHome+'sanur /i '+$ScriptHome+'test.dat' WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Updates','Sheild 1024x768','1','REG_DWORD') EndIf
case $screenres1 = "800x600" If NOT ReadValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Updates','Sheild 800x600') = 1 SHELL '%comspec% /c runas /u:home\Administrator "msiexec /i '+$ScriptMSI+'Shield800.msi" | '+$ScriptHome+'sanur /i '+$ScriptHome+'test.dat' WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Updates','Sheild 800x600','1','REG_DWORD') EndIf
case 1 ; Must be using some other resolution endselect
;REG_SZ
;$logfile = "\\sapdc\NETLOGON\MSI\MSI Batch Files\Citlogon.log" ;$RC = Open(1, $logfile, 5) ;$RC = WriteLine(1,"Logon Time: "+@USERID+", "+@WKSTA+", "+@Day+", "+@DATE+","+@TIME+@CRLF+)
|
|
Top
|
|
|
|
#189025 - 2008-08-05 11:34 PM
Re: Installing an msi file with sanur.exe
[Re: xempa]
|
xempa
Fresh Scripter
Registered: 2006-08-12
Posts: 37
|
Hi Kyder
Many thanks for your help here. However I'm not sure I understand correctly your response
Under both scenarios as administrator and domain user all MSI files install perfectly.
My prob comes about when using kix writeValue to write to the registry. This writes fine if you have logged in as an admin but not domain user.
oddly enought I originlly called a batch file inside kix that ran sanur successfully (with admin privildeges to install the msi) then immediately proceeding a writevalue in kix and this worked well.
I saw some earlier documentation where it stated a domain user could only write to HKCU not HKLM ?
However I think maybe the way I'm calling sanur it's not holding it's admin priveledge long enough to write to the registry
Hope this makes sense
cheers Cheers
|
|
Top
|
|
|
|
#189032 - 2008-08-06 10:09 AM
Re: Installing an msi file with sanur.exe
[Re: xempa]
|
xempa
Fresh Scripter
Registered: 2006-08-12
Posts: 37
|
Thanks Mark and Kyder
I think I've just nailed it. It's because as domain user you don't have permissions to write to the HKLM. This script now works because I am writing to HKCU instead.
Also possibly the way I referenced HKCU as per HKEY_CURRENT_USER that it is now working ?
This works:
WriteValue('HKEY_CURRENT_USER\Software\Microsoft\Updates','Waikaremoana','1','REG_DWORD')
This doesn't
WriteValue('HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\Updates','Waikaremoana','1','REG_DWORD')
Many thanks to you both for helping me though this
Cheers
|
|
Top
|
|
|
|
#189048 - 2008-08-06 11:05 PM
Re: Installing an msi file with sanur.exe
[Re: xempa]
|
xempa
Fresh Scripter
Registered: 2006-08-12
Posts: 37
|
Awesome Richard
Thanks very much for this info , this is useful to know
Many thanks
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 2220 anonymous users online.
|
|
|