#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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 661 anonymous users online.
|
|
|