Page 1 of 1 1
Topic Options
#179230 - 2007-08-13 02:21 PM KIX Script to output kix variables
KIXKicks Offline
Starting to like KiXtart

Registered: 2002-07-26
Posts: 177
Loc: Vancouver, WA
I am trying to change the Registry in Vista, but it is protected so I want my kix script to generate a reg file and use the elevate.cmd to import it.

Here is what the reg file (printerins.reg) should contain:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\xxx.xxx.xxx.xxx]
"Protocol"=dword:00000002
"Version"=dword:00000002
"Hostname"="xxx.xxx.xxx.xxx"
"IPAddress"=""
"HWAddress"=""
"PortNumber"=dword:00000203
"SNMP Community"="public"
"SNMP Enabled"=dword:00000001
"SNMP Index"=dword:00000001
"PortMonMibPortIndex"=dword:00000000
"Queue"="RAW"
"Double Spool"=dword:00000001

Here is the code:

 Code:
IF $VISTA32="YES" OR $VISTA64="YES"
	$IPPRINTERKEY='$REMOTEPC\$HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\PRINT\MONITORS\STANDARD TCP/IP PORT\PORTS\' +$PORT	
			ELSE
				$IPPRINTERKEY='$REMOTEPC\$HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\PRINT\MONITORS\STANDARD TCP/IP PORT\PORTS\IP_' +$PORT
			ENDIF

			? "IPPRINTERKEY: " $IPPRINTERKEY

			IF KEYEXIST($IPPRINTERKEY)
				$=DELTREE($IPPRINTERKEY)
			ENDIF
			
			IF $VISTA32="YES" OR $VISTA64="YES"
				IF NOT KEYEXIST($IPPRINTERKEY)
			        	$=ADDKEY($IPPRINTERKEY)
				        $=WRITEVALUE($IPPRINTERKEY,"Double Spool","00000001","REG_DWORD")
					$=WRITEVALUE($IPPRINTERKEY,"HostName","$PORT", "REG_SZ")
					$=WRITEVALUE($IPPRINTERKEY,"HWAddress","","REG_SZ")
					$=WRITEVALUE($IPPRINTERKEY,"IPAddress","","REG_SZ")
					$=WRITEVALUE($IPPRINTERKEY,"SNMP Community","public","REG_SZ")
        				$=WRITEVALUE($IPPRINTERKEY,"SNMP Index","00000001","REG_DWORD")
			        	$=WRITEVALUE($IPPRINTERKEY,"VERSION","00000002","REG_DWORD")
				ENDIF
			ELSE
				IF NOT KEYEXIST($IPPRINTERKEY)
			        	$=ADDKEY($IPPRINTERKEY)
				        $=WRITEVALUE($IPPRINTERKEY,"Double Spool","00000001","REG_DWORD")
					$=WRITEVALUE($IPPRINTERKEY,"HostName","", "REG_SZ")
					$=WRITEVALUE($IPPRINTERKEY,"HWAddress","","REG_SZ")
					$=WRITEVALUE($IPPRINTERKEY,"IPAddress","$PORT","REG_SZ")
					$=WRITEVALUE($IPPRINTERKEY,"SNMP Community","public","REG_SZ")
        				$=WRITEVALUE($IPPRINTERKEY,"SNMP Index","00000001","REG_DWORD")
			     		$=WRITEVALUE($IPPRINTERKEY,"VERSION","00000001","REG_DWORD")
				ENDIF
			ENDIF


FOR EACH $SPOOLER IN $SERVICES
				IF $VISTA32="YES" OR $VISTA64="YES"
					SHELL '%COMSPEC% /C C:\NETWORK\ELEVATE.CMD NET START "Print Spooler" >NUL'
				ELSE
					$=EXECUTE('$$=$$SPOOLER.STARTSERVICE()')
				ENDIF
			NEXT
$OBJECTS=GETOBJECT("WINMGMTS:{IMPERSONATIONLEVEL=IMPERSONATE}!"+$REMOTEPC+"\ROOT\CIMV2")

			IF NOT @ERROR=0
				EXIT -4
			ENDIF

			$SERVICES=$OBJECTS.EXECQUERY('Select * from Win32_Service WHERE Name = "Spooler"')
      			
			FOR EACH $SPOOLER IN $SERVICES
				IF $VISTA32="YES" OR $VISTA64="YES"
					SHELL '%COMSPEC% /C C:\NETWORK\ELEVATE.CMD NET STOP "Print Spooler" >NUL'
				ELSE
					$=EXECUTE('$$=$$SPOOLER.STOPSERVICE()')
				ENDIF
			NEXT
	 		
			IF $VISTA32="YES" OR $VISTA64="YES"
				? "Give User Time To Answer Prompts..."
				SLEEP 15
			ELSE
				SLEEP 3
			ENDIF
			IF $VISTA32="YES" OR $VISTA64="YES"
				? "Give User Time To Answer Prompts..."
				SLEEP 15
			ELSE
				SLEEP 3
			ENDIF

			IF $VISTA32="YES" OR $VISTA64="YES"
				$PORT='$PORT'	
			ELSE
				$PORT='IP_$PORT'
			ENDIF


I did some brief searching on the forums but couldn't find anything that provided what I was looking for. I am sure I could piece meal something together but hoped there were something already out there...


Edited by KIXKicks (2007-08-13 02:50 PM)

Top
#179302 - 2007-08-14 11:40 PM Re: KIX Script to output kix variables [Re: KIXKicks]
KIXKicks Offline
Starting to like KiXtart

Registered: 2002-07-26
Posts: 177
Loc: Vancouver, WA
Figured it out...
Top
#179333 - 2007-08-15 01:00 PM Re: KIX Script to output kix variables [Re: KIXKicks]
Björn Offline
Korg Regular
*****

Registered: 2005-12-07
Posts: 953
Loc: Stockholm, Sweden.
If you post the conclusion you came to - others will surely benefit from it :).
_________________________
as long as it works - why fix it?
If it doesn't work - kix-it!

Top
#179363 - 2007-08-15 08:57 PM Re: KIX Script to output kix variables [Re: Björn]
KIXKicks Offline
Starting to like KiXtart

Registered: 2002-07-26
Posts: 177
Loc: Vancouver, WA
Unfortunately, without Admin Rights it doesn't work yet...however if you have Admin Rights on the workstation it does work with a change to the Group Policy.

Group Policy: On a workstation running MS Vista, Start->Run->type in gpmc.msc to load the Group Policy Object Editor. Then edit the domain policy->Computer Configuration->Windows Settings->Security Options and change the User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode to Elevate without prompting.

Then download the Elevate.cmd & Elevate.vbs from Microsoft Vista PowerToys.

 Code:
FUNCTION ADDPRINTER($PORT,$PRINTERTYPE,OPTIONAL $DRIVERINF,$DRIVERNAME,$UNVNAME,$PRINTERDESC,$PORTNUMBERKEY,$PRINTERKEY,$PRINTERDLL,$PROTOCOLKEY,$QUEUEKEY,$SNMPENABLED,$REMOTEPC,$DEFAULT)
	DIM $QUITLOOP,$IPPRINTERKEY,$PRINTERCMD
  	
	$ADDPRINTER=0
	$ADDQUEUE=0
  	$PRINTERPROCINSTALL="NO"
			
	? "Starting Add Printer..." ?		
	
	? "PORT: " $PORT
	? "PRINTERTYPE: " $PRINTERTYPE
	? "DRIVERINF: " $DRIVERINF
	? "DRIVERNAME: " $DRIVERNAME
	? "UNIVERSALNAME: " $UNVNAME
	? "PRINTERDESC: " $PRINTERDESC
	? "PORTNUMBERKEY: " $PORTNUMBERKEY
	? "PRINTERKEY: " $PRINTERKEY
	? "PRINTERDLL: " $PRINTERDLL
	? "PROTOCOLKEY: " $PROTOCOLKEY
	? "QUEUEKEY: " $QUEUEKEY
	? "SNMPENABLED: " $SNMPENABLED
	? "REMOTEPC: " $REMOTEPC
	? "DEFAULT: " $DEFAULT ?

	IF NOT LEFT($PORT,2)="\\"
		
		IF $DRIVERINF=""
			? "Using Built-In Windows Drivers"
			$DRIVERINF="%WINDIR%\INF\NTPRINT.INF"
		ENDIF
		
		IF NOT EXIST($DRIVERINF)
			? "INF File Does Not Exist!"
			EXIT -3
		ENDIF
		
		? "Parsing INF File..."
		SHELL '%COMSPEC% /C TYPE "$DRIVERINF">%TEMP%\ADDPRINTER.TXT'
		
		IF OPEN(3,"%TEMP%\ADDPRINTER.TXT",0)=0
			$QUITLOOP=0
			
			IF $VISTA32="YES" OR $VISTA64="YES"
				WHILE @ERROR=0 AND $QUITLOOP=0
					$LINE=READLINE(3)
					IF $UNVNAME=""
						$QUITLOOP=INSTR($LINE,$PRINTERTYPE)
					ELSE
						$QUITLOOP=INSTR($LINE,$UNVNAME)
					ENDIF
				LOOP
			ELSE
				WHILE @ERROR=0 AND $QUITLOOP=0
					$LINE=READLINE(3)
					$QUITLOOP=INSTR($LINE,$PRINTERTYPE)
				LOOP
			ENDIF

			$=CLOSE(3)
			
			IF $QUITLOOP=0
				EXIT -2
			ENDIF
			
		ELSE
			EXIT -3
		ENDIF
	ENDIF

	IF $PRINTERDESC=""
		$PRINTERDESC=$DRIVERNAME
	ENDIF

	IF $REMOTEPC=""
		$REMOTEPC='\\'+ @WKSTA
	ELSE
		IF NOT LEFT($REMOTEPC,2)="\\"
			$REMOTEPC='\\' + $REMOTEPC
		ENDIF
  	ENDIF

	SELECT 
    		CASE LEFT($PORT,2)="\\"
			$PRINTSERVER=1
			$PRINTERDESC=$PORT
		CASE INSTR($PORT,".")
			$REGFILE="C:\NETWORK\PRINTERWIZ.REG"
			IF EXIST ($REGFILE)
				DEL ($REGFILE)
			ENDIF

			
			OPEN(3,$REGFILE,5)
			$=WRITELINE(3,"Windows Registry Editor Version 5.00"+@CRLF)
			$=WRITELINE(3,@CRLF)
			$=WRITELINE(3,"[-HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\"+$PORT+"]"+@CRLF)
			CLOSE(3)

			? "Removing Existing Port Keys..."
			IF $VISTA32="YES" OR $VISTA64="YES"
				SHELL '%COMSPEC% /C C:\NETWORK\ELEVATE.CMD REGEDIT /S $REGFILE'
			ELSE
				SHELL '%COMSPEC% /C REGEDIT /S $REGFILE'
			ENDIF
		
			SLEEP 3

			? "Done Removing Existing Port Keys..."
			IF EXIST ($REGFILE)
				DEL ($REGFILE)
			ENDIF
			
			SLEEP 3

			? "Creating New Registry File..."
			IF $VISTA32="YES" OR $VISTA64="YES"
				$IPPRINTERKEY='$REMOTEPC\$HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\PRINT\MONITORS\STANDARD TCP/IP PORT\PORTS\' +$PORT
				
				? "Creating Print Port Registry File For Vista"
				OPEN(3,$REGFILE,5)
				$=WRITELINE(3,"Windows Registry Editor Version 5.00"+@CRLF)
				$=WRITELINE(3,@CRLF)
				$=WRITELINE(3,"[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\"+$PORT+"]"+@CRLF)
				$=WRITELINE(3,CHR(34)+"Double Spool"+CHR(34)+"=dword:00000001"+@CRLF)						
				$=WRITELINE(3,CHR(34)+"HostName"+CHR(34)+"="+CHR(34)+$PORT+CHR(34)+@CRLF)
				$=WRITELINE(3,CHR(34)+"HWAddress"+CHR(34)+"="+CHR(34)+CHR(34)+@CRLF)
				$=WRITELINE(3,CHR(34)+"IPAddress"+CHR(34)+"="+CHR(34)+CHR(34)+@CRLF)
				$=WRITELINE(3,CHR(34)+"PortMonMibPortIndex"+CHR(34)+"=dword:00000000"+@CRLF)
				$=WRITELINE(3,CHR(34)+"PortNumber"+CHR(34)+"=dword:00000203"+@CRLF)
				$=WRITELINE(3,CHR(34)+"Protocol"+CHR(34)+"=dword:00000002"+@CRLF)
				$=WRITELINE(3,CHR(34)+"Queue"+CHR(34)+"="+CHR(34)+"RAW"+CHR(34)+@CRLF)
				$=WRITELINE(3,CHR(34)+"SNMP Community"+CHR(34)+"="+CHR(34)+"public"+CHR(34)+@CRLF)
				$=WRITELINE(3,CHR(34)+"SNMP Enabled"+CHR(34)+"=dword:00000001"+@CRLF)
				$=WRITELINE(3,CHR(34)+"SNMP Index"+CHR(34)+"=dword:00000001"+@CRLF)
				$=WRITELINE(3,CHR(34)+"Version"+CHR(34)+"=dword:00000002"+@CRLF)
				
				? "Creating Printer Processor Registry File For Vista"
				IF $PRINTERKEY<>""
					? "PRINTERKEY: " $PRINTERKEY
					
					IF $OSBIT="64 Bit"
						$PRINTPROCOS="WINDOWS x64"
						$PRINTPROCREGKEY='$REMOTEPC\$HKLM\$SYSCCS\CONTROL\PRINT\ENVIRONMENTS\WINDOWS x64\PRINT PROCESSORS\'+$PRINTERKEY
					ELSE
						$PRINTPROCOS="WINDOWS NT x86"
						$PRINTPROCREGKEY='$REMOTEPC\$HKLM\$SYSCCS\CONTROL\PRINT\ENVIRONMENTS\WINDOWS NT x86\PRINT PROCESSORS\'+$PRINTERKEY
					ENDIF
					
					$=WRITELINE(3,@CRLF)
					$=WRITELINE(3,"["+$HKLM+"\SYSTEM\CurrentControlSet\Control\Print\Environments\"+$PRINTPROCOS+"\Print Processors\"+$PRINTERKEY+"]"+@CRLF)
					$=WRITELINE(3,CHR(34)+"Driver"+CHR(34)+"="+CHR(34)+$PRINTERDLL+CHR(34)+@CRLF)
					;$PRINTERPROCINSTALL="YES"
					;$POPUPALERTMESSAGE1=""
					;$POPUPALERTMESSAGE2=""
					;$POPUPALERTMESSAGE3=""
					;$POPUPALERTMESSAGE4=""
					;$POPUPALERTMESSAGE5=""
					;$FORMMAIN.MOUSEPOINTER=0
					;ALERTMESSAGES()
				ENDIF

				? "Writing Registry File..."
				CLOSE(3)
				? "Closing Registry File..."
			ELSE
				$IPPRINTERKEY='$REMOTEPC\$HKLM\SYSTEM\CURRENTCONTROLSET\CONTROL\PRINT\MONITORS\STANDARD TCP/IP PORT\PORTS\IP_' +$PORT

				? "Creating Print Port Registry File For XP"
				OPEN(3,$REGFILE,5)
				$=WRITELINE(3,"Windows Registry Editor Version 5.00"+@CRLF)
				$=WRITELINE(3,@CRLF)
				$=WRITELINE(3,"[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Print\Monitors\Standard TCP/IP Port\Ports\IP_"+$PORT+"]"+@CRLF)
				$=WRITELINE(3,CHR(34)+"Double Spool"+CHR(34)+"=dword:00000001"+@CRLF)						
				$=WRITELINE(3,CHR(34)+"HostName"+CHR(34)+"="+CHR(34)+CHR(34)+@CRLF)
				$=WRITELINE(3,CHR(34)+"HWAddress"+CHR(34)+"="+CHR(34)+CHR(34)+@CRLF)
				$=WRITELINE(3,CHR(34)+"IPAddress"+CHR(34)+"="+CHR(34)+$PORT+CHR(34)+@CRLF)
				$=WRITELINE(3,CHR(34)+"PortNumber"+CHR(34)+"=dword:00000203"+@CRLF)
				$=WRITELINE(3,CHR(34)+"Protocol"+CHR(34)+"=dword:00000002"+@CRLF)
				$=WRITELINE(3,CHR(34)+"Queue"+CHR(34)+"="+CHR(34)+"RAW"+CHR(34)+@CRLF)
				$=WRITELINE(3,CHR(34)+"SNMP Community"+CHR(34)+"="+CHR(34)+"public"+CHR(34)+@CRLF)
				$=WRITELINE(3,CHR(34)+"SNMP Enabled"+CHR(34)+"=dword:00000001"+@CRLF)
				$=WRITELINE(3,CHR(34)+"SNMP Index"+CHR(34)+"=dword:00000001"+@CRLF)
				$=WRITELINE(3,CHR(34)+"Version"+CHR(34)+"=dword:00000001"+@CRLF)
			
				? "Creating Printer Processor Registry File For XP"
				IF $PRINTERKEY<>""
					? "PRINTERKEY: " $PRINTERKEY

					IF $OSBIT="64 Bit"
						$PRINTPROCOS="WINDOWS x64"
						$PRINTPROCREGKEY='$REMOTEPC\$HKLM\$SYSCCS\CONTROL\PRINT\ENVIRONMENTS\WINDOWS x64\PRINT PROCESSORS\'+$PRINTERKEY
					ELSE
						$PRINTPROCOS="WINDOWS NT x86"
						$PRINTPROCREGKEY='$REMOTEPC\$HKLM\$SYSCCS\CONTROL\PRINT\ENVIRONMENTS\WINDOWS NT x86\PRINT PROCESSORS\'+$PRINTERKEY
					ENDIF
					
					$=WRITELINE(3,@CRLF)
					$=WRITELINE(3,"["+$HKLM+"\SYSTEM\CurrentControlSet\Control\Print\Environments\"+$PRINTPROCOS+"\Print Processors\"+$PRINTERKEY+"]"+@CRLF)
					$=WRITELINE(3,CHR(34)+"Driver"+CHR(34)+"="+CHR(34)+$PRINTERDLL+CHR(34)+@CRLF)
					;$PRINTERPROCINSTALL="YES"
					;$POPUPALERTMESSAGE1=""
					;$POPUPALERTMESSAGE2=""
					;$POPUPALERTMESSAGE3=""
					;$POPUPALERTMESSAGE4=""
					;$POPUPALERTMESSAGE5=""
					;$FORMMAIN.MOUSEPOINTER=0
					;ALERTMESSAGES()
				ENDIF

				? "Writing Registry File..."
				CLOSE(3)
				? "Closing Registry File..."
			ENDIF

			? "IPPRINTERKEY: " $IPPRINTERKEY
		
			? "Installing New Printer Port..."
			IF $VISTA32="YES" OR $VISTA64="YES"
				SHELL '%COMSPEC% /C C:\NETWORK\ELEVATE.CMD REGEDIT /S $REGFILE'
			ELSE
				SHELL '%COMSPEC% /C REGEDIT /S $REGFILE'
			ENDIF

			$OBJECTS=GETOBJECT("WINMGMTS:{IMPERSONATIONLEVEL=IMPERSONATE}!"+$REMOTEPC+"\ROOT\CIMV2")

			IF NOT @ERROR=0
				EXIT -4
			ENDIF

			$SERVICES=$OBJECTS.EXECQUERY('Select * from Win32_Service WHERE Name = "Spooler"')
      			
			FOR EACH $SPOOLER IN $SERVICES
				IF $VISTA32="YES" OR $VISTA64="YES"
					SHELL '%COMSPEC% /C C:\NETWORK\ELEVATE.CMD NET STOP "Print Spooler" >NUL'
				ELSE
					$=EXECUTE('$$=$$SPOOLER.STOPSERVICE()')
				ENDIF
			NEXT
	 		
			SLEEP 3
			
			FOR EACH $SPOOLER IN $SERVICES
				IF $VISTA32="YES" OR $VISTA64="YES"
					SHELL '%COMSPEC% /C C:\NETWORK\ELEVATE.CMD NET START "Print Spooler" >NUL'
				ELSE
					$=EXECUTE('$$=$$SPOOLER.STARTSERVICE()')
				ENDIF
			NEXT

			SLEEP 3

			IF $VISTA32="YES" OR $VISTA64="YES"
				$PORT='$PORT'	
			ELSE
				$PORT='IP_$PORT'
			ENDIF

		CASE UCASE(LEFT($PORT,3))="LPT" OR UCASE(LEFT($PORT,3))="COM"
			IF NOT RIGHT($PORT,1)=":"
			        $PORT=$PORT+":"
			ENDIF

			IF NOT VAL(LEFT(RIGHT($PORT,2),1))>=1
				EXIT -1 
			ENDIF

		CASE UCASE(LEFT($PORT,4))="FILE"
			IF NOT RIGHT($PORT,1)=":"
				$PORT=$PORT+":"
			ENDIF

		CASE 1
			EXIT -1
	ENDSELECT

	? "PORT: " $PORT
	? "PRINTERTYPE: " $PRINTERTYPE
	? "DRIVERINF: " $DRIVERINF
	? "DRIVERNAME: " $DRIVERNAME
	? "PRINTERDESC: " $PRINTERDESC
	? "PORTNUMBERKEY: " $PORTNUMBERKEY
	? "PRINTERKEY: " $PRINTERKEY
	? "PRINTERDLL: " $PRINTERDLL
	? "PROTOCOLKEY: " $PROTOCOLKEY
	? "QUEUEKEY: " $QUEUEKEY
	? "SNMPENABLED: " $SNMPENABLED
	? "REMOTEPC: " $REMOTEPC
	? "DEFAULT: " $DEFAULT
	
	IF NOT $PRINTSERVER=1
		$PRINTERCMD='RUNDLL32 PRINTUI.DLL,PrintUIEntry /if /b "$PRINTERDESC" /c "$REMOTEPC" /f "$DRIVERINF" /r "$PORT" /m "$PRINTERTYPE" /z'
		
		? "PRINTERCMD: " $PRINTERCMD
		IF $VISTA32="YES" OR $VISTA64="YES"
			SHELL '%COMSPEC% /C C:\NETWORK\ELEVATE.CMD $PRINTERCMD'
		ELSE
			SHELL $PRINTERCMD
		ENDIF
		
	ELSE
		IF NOT ADDPRINTERCONNECTION($PORT)=0
			EXIT @ERROR
		ENDIF
	ENDIF

	IF $DEFAULT=1
		IF NOT SETDEFAULTPRINTER($PRINTERDESC)=0
			EXIT @ERROR
		ENDIF
	ENDIF

	$ADDPRINTER=1

	? "Done Removing Existing Port Keys..."
	IF EXIST ($REGFILE)
		DEL ($REGFILE)
	ENDIF
	
	MESSAGESTATUS("Finishing Installing Printer - Select Another Printer Or Quit",BLUE)

	$FORMMAIN.MOUSEPOINTER=0
ENDFUNCTION



Edited by KIXKicks (2007-08-15 09:08 PM)

Top
#179364 - 2007-08-15 09:01 PM Re: KIX Script to output kix variables [Re: KIXKicks]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Could you remove the long line?

Using optional in a function will make all parameters after the first optional optional so there is no need to add optional in front of every optional parameter.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#179366 - 2007-08-15 09:09 PM Re: KIX Script to output kix variables [Re: Mart]
KIXKicks Offline
Starting to like KiXtart

Registered: 2002-07-26
Posts: 177
Loc: Vancouver, WA
Better? I didn't know that about optional...thanks.
Top
#179367 - 2007-08-15 09:18 PM Re: KIX Script to output kix variables [Re: KIXKicks]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Yep.
Still quite a long line but hey sh#t happens. Sometimes it is just a long line because it is a long line and there is nothing one could do about it.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#179378 - 2007-08-15 11:37 PM Re: KIX Script to output kix variables [Re: Mart]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
Mart,
AFAIK, using Optional once for all optional parameters is an "undocumented feature". I think it is just nice to know.

Top
#179484 - 2007-08-20 11:38 PM Re: KIX Script to output kix variables [Re: Witto]
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Just a question.. If you cannot read the registry (i.e. have to elevate privs).. Couldn't you just do a ver /r and pipe that back to your script to get the OS version?

Thanks,

Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#179487 - 2007-08-21 09:24 AM Re: KIX Script to output kix variables [Re: Kdyer]
Witto Offline
MM club member
*****

Registered: 2004-09-29
Posts: 1828
Loc: Belgium
/r is not supported as parameter for ver (anymore).
ISTR it was supported in the early dos days.
Do you mean a batch file starting like this?
 Code:
Ver | Find "6.0." > nul 
If not errorlevel 1 Goto Vista

Ver | Find "5.2." > nul 
If not errorlevel 1 Goto W2K3 

Ver | Find "Windows XP" > nul 
If not errorlevel 1 Goto WXP 

Ver | Find "Windows 2000" > nul 
If not errorlevel 1 Goto W2000 

Ver | Find "Windows NT" > nul 
If not errorlevel 1 Goto WNT 

Ver | Find "Windows 98" > nul 
If not errorlevel 1 Goto W98 

Ver | Find "Windows 95" > nul 
If not errorlevel 1 Goto W95 

Ver | Find "Windows ME" > nul 
If not errorlevel 1 Goto WME 

Ver | Find "OEM Service Release" > nul 
If not errorlevel 1 Goto WOEM 

Ver | Find "MS-DOS" > nul 
If not errorlevel 1 Goto DOS 

Goto Unknown_OS


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 846 anonymous users online.
Newest Members
StuTheCoder, M_Moore, BeeEm, min_seow, Audio
17884 Registered Users

Generated in 0.179 seconds in which 0.148 seconds were spent on a total of 13 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org