#41320 - 2003-06-10 11:20 AM
KXRPC Auto Upgrade/Install
|
Julian
Starting to like KiXtart
Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
|
Hi,
I have modified Bryce's su_install.kix (Hope you don't mind) to upgrade/install the KiXtart RPC Service on selected servers. Code below, some of the lines are quite long.
code:
break on cls ;--------------------------------------------------------- ; KXRPC Install 2.0 by Bryce Lindsay EMAIL: bryce@hti.net ; ; This Kix script will install the KiXtart RPC Service service on a ; list of target NT computers. the KiXtart RPC Service serveice is ; needed so that Windows 9x clients can gather extended information, ; such as local groups. ; ; this script requires a file with a list target ; computers in it. for systems that you do not have ; administrator access on, place a ; ; \\computername,username with admin rights,password ; ; in the computer list file. ; ; ---sample file--- ; \\computer1,username,password ; \\computer2 ; \\computer3 ; ---sample file--- ; ; Or see the my "Computer List" kix script @ ; http://kix.isorg.net/other_scripts/ ; ; ; Additional script requirements ; 1. Be ran from a computer that had administrator rights ; on the target computers. (or have the administrator ; username and password) ; 2. You need the program xnet.exe ; 3. You need the programs kxrpc.exe in the same ; directory that this script is in. ;--------------------------------------------------------- $computerlist = "clist.dat" $tempfile = "%temp%\temp.txt"
$AutoReinstall = "yes" ;set to "yes" to auto anwser yes on the reinstall question ;set to "no" to auto anwser no ;set to "ask" to get get asked ;--------------------------------------------------------- if open(1,"$computerlist",2) <> 0 ? '"@serror" opening $computerlist' ? "You must provide a list of target computers for this script to work." exit endif
$temp = readline(1) do if instr("$temp",",") <> 0 $target = substr("$temp",1,instr("$temp",",")-1) $targetname = substr("$target",3,len("$target")) $temp = substr("$temp",len("$target")+2,len("$temp")) $targetadmin = substr("$temp",1,instr("$temp",",")-1) $targetpassword = substr("$temp",len("$targetadmin")+2,len("$temp")) else $target = rtrim(substr($temp,1,23)) $targetname = substr("$target",3,len("$target")) $targetadmin = "" $targetpassword = "" endif
IF $targetadmin <> "" use "$target\ipc$$" /user:'$targetname\$targetadmin' /password:$targetPassword else use "$target\ipc$$" endif
Select case @error = 0 ? "____ $target _________________________________________________________________________"
$targetSystemRoot = readvalue("$target\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\","SystemRoot") shell '%comspec% /c xnet list "$target\KiXtart RPC Service" | find /i "Service state" > $tempfile' if getfilesize($tempfile) <> 0 ? "KiXtart RPC Service is already installed $$autoreinstall set to $autoreinstall" select case $autoreinstall = "yes" $yn = "y" case $autoreinstall = "no" $yn = "n" case 1 ? " The KiXtart RPC Service on $target is allready installed. Would you like to reinstall?(Y/N)" :wrong get $yn Select case $yn = "y" case $yn = "n" case 1 beep goto wrong endselect endselect select case $yn = "y" ? " Stopping KiXtart RPC Service.." shell '%comspec% /c xnet stop "$target\KiXtart RPC Service" > nul' do shell '%comspec% /c xnet list $target | find /i "KiXtart RPC Service" > $tempfile' $nul = open(2,$tempfile,2) $data = readline(2) $nul = close (2) del $tempfile "." sleep 1 until substr("$data",63,len("$data")) = "stopped" ? " KiXtart RPC Service on $target has been stopped, removing KiXtart RPC Service" shell '%comspec% /c xnet remove "$target\KiXtart RPC Service" /y > nul' ? ? " Installing KiXtart RPC Service on $target.." copy "kxrpc.exe" "$target\admin$\system32\kxrpc.exe" ? " @serror: for copy kxrpc.exe" ? " " shell '%comspec% /c xnet install "$target\KiXtart RPC Service" /b:$targetSystemRoot\system32\kxrpc.exe /d:RpcSs /n:"KiXtart RPC Service" /u:LocalSystem /s:auto' shell '%comspec% /c xnet start "$target\KiXtart RPC Service" > nul' case $yn = "n" ;do nothing endselect else ? "Installing KiXtart RPC Service on $target.." copy "kxrpc.exe" "$target\admin$\system32" ? "@serror: for copy kxrpc.exe" ? shell '%comspec% /c xnet install "$target\KiXtart RPC Service" /b:$targetSystemRoot\system32\kxrpc.exe /d:RpcSs /n:"KiXtart RPC Service" /u:LocalSystem /s:auto' shell '%comspec% /c xnet start "$target\KiXtart RPC Service"' endif
case @error <> 0 ? "____ $target _________________________________________________________________________" ? "Can't connect to $Target -OR- you have insufecent rights" endselect
use "$target\ipc$$" /delete
$temp = readline(1) until @error <> 0
exit
The problem i'm having is that it won't copy the kxrpc.exe to the target machine even though the service has stopped. If i manually dial into the server and delete the kxrpc.exe its fine.
I am running the script with KiX V4.21 on a Windows XP client. The target machines are all Windows NT4.0. Has anybody got any ideas other that doing it manually?
Many Thanks
Julian [ 10. June 2003, 11:21: Message edited by: Julian ]
|
|
Top
|
|
|
|
#41321 - 2003-06-10 02:10 PM
Re: KXRPC Auto Upgrade/Install
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Julian,
When running this, you are a Domain Admin or running it under a Domain Admin Context? The \\Server\Admin$ is an administrative share.
HTH,
Kent
|
|
Top
|
|
|
|
#41323 - 2003-06-10 02:31 PM
Re: KXRPC Auto Upgrade/Install
|
Julian
Starting to like KiXtart
Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
|
Hi,
Yes i'm in the Domain Admins group so should have full access to the remote server. I can also gain access to the admin$ share manually.
I tried putting a 15 second delay in with no luck.
Thanks
Julian
|
|
Top
|
|
|
|
#41324 - 2003-06-10 02:44 PM
Re: KXRPC Auto Upgrade/Install
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
Julian,
Don't think a 10-15 second sleep is needed. Maybe a second or two at most.
Try this..
Make a simple test KiXtart script with just the following line -
code:
copy "kxrpc.exe" "\\DCSERVER\admin$\system32"
If that still does not work, try -
code:
copy "kxrpc.exe" "\\DCSERVER\admin$$\system32"
Once you get this to work, replace that back in the main script (replacing \\DCSERVER with $target) and go..
Please let us know if this does/does not work.
HTH,
Kent [ 10. June 2003, 14:47: Message edited by: kdyer ]
|
|
Top
|
|
|
|
#41325 - 2003-06-10 04:50 PM
Re: KXRPC Auto Upgrade/Install
|
Julian
Starting to like KiXtart
Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
|
Kyder, I have tried those two suggestions and I still get access denied. It doesnt look as though its a kix problem, more a problem with perms or something like that.
Thanks
|
|
Top
|
|
|
|
#41326 - 2003-06-10 05:01 PM
Re: KXRPC Auto Upgrade/Install
|
Julian
Starting to like KiXtart
Registered: 2000-04-20
Posts: 112
Loc: Newcastle, Staffs, UK
|
Kyder - Just to let you know I decided to run the script with a couple more test servers in our organization. It worked on both of them with no problems at all. So ive decided to run it on all of them and it seems to have been 90% succesful. Still not sure why it didnt work on the others. If i find out i'l let you know.
Thanks for your help anyway.
Julian
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(StuTheCoder)
and 798 anonymous users online.
|
|
|