JSP
(Fresh Scripter)
2010-09-01 06:08 PM
Write Registry Key based on Computername

Hi All-

My company just switched to Lotus Notes (I know, pitty me), many of our users work off a Terminal Server, in order for notes to work a change needs to be made in HKCU, I'd like to do that via the login script but I only need it to run if they are logging into the Terminal Servers. Is there a way to execute the write command based on computername? Any help would be appreciated, here are the the registry entries.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Lotus\Notes\8.0]
"NotesIniPath"="U:\\Lotus\\Notes\\Data\\notes.ini"
"NeedCommonFiles"=dword:00000001


eriqjaffe
(Hey THIS is FUN)
2010-09-01 06:36 PM
Re: Write Registry Key based on Computername

There are a couple of ways, ultimately.

Depending on the naming structure of your Terminal Servers, you can use INSTR or LEFT:

 Code:
if INSTR(@WKSTA,"Terminal") = 1
     ; do things

 Code:
if LEFT(@WKSTA,5) = "Termi"
     ; do things

INSTR will just look for the string - "Terminal Server 1" and "Bills Terminal Illness" will both return positives, and that may not be what you want.

LEFT will only return positive if the LEFT x characters match - "Terminal Server 1" would be positive, "Bills Terminal Illness" wouldn't.

You could also use the @TSSESSION macro to determine if it's a Terminal Services session:

 Code:
IF @TSSESSION = 1
     ; do things


Mart
(KiX Supporter)
2010-09-01 08:04 PM
Re: Write Registry Key based on Computername

Hard coding (part of) the server name(s) is something that I would not recommend because when names are change dor servers are added you need to modify the script manually. Could be a PITA.
If it is just MS TS then @TSSession would do the trick. If you have MS TS servers and ICA (Citrix) servers and need to do different things for either one of them then the SessionType UDF will work for you.

UDF Library » SessionType() - Gets the session type for the current user


JSP
(Fresh Scripter)
2010-09-09 07:34 PM
Re: Write Registry Key based on Computername

Thanks! That's just what I need.

JSP
(Fresh Scripter)
2010-09-09 10:21 PM
Re: Write Registry Key based on Computername

Well I tried my script, but it's not working, maybe i'm missing something.

 Code:
If LEFT(@WKSTA,7) = "MTSCApp"
	If InGroup ("AltLNDrive")=1
		RegWrite("HKEY_CURRENT_USER\Software\Lotus\Notes\8.0", "NotesIniPath", "G:\Lotus\Notes\Data\notes.ini", "Reg_SZ")
 		RegWrite("HKEY_CURRENT_USER\Software\Lotus\Notes\8.0", "NeedCommonFiles", "00000001", "Reg_DWord")
	Else
		RegWrite("HKEY_CURRENT_USER\Software\Lotus\Notes\8.0", "NotesIniPath", "U:\Lotus\Notes\Data\notes.ini", "Reg_SZ")
 		RegWrite("HKEY_CURRENT_USER\Software\Lotus\Notes\8.0", "NeedCommonFiles", "00000001", "Reg_DWord")
		
	EndIf
EndIf


AllenAdministrator
(KiX Supporter)
2010-09-09 10:33 PM
Re: Write Registry Key based on Computername

Regwrite? Do you mean WriteValue?

JSP
(Fresh Scripter)
2010-09-09 10:48 PM
Re: Write Registry Key based on Computername

I've tried both, neither work, something pops up in red on the splash screen when the script runs, but it goes by too fast to read. I think the problem is with the LEFT(@wksta) part, i get the red error regardless of the server i'm logging into.

Mart
(KiX Supporter)
2010-09-10 08:57 AM
Re: Write Registry Key based on Computername

What happens when you run the script in debug mode (kix32.exe yourscript.kix /d)? By default Kix does not show errors in red. With the debug mode you might be able to find out what line is causing this.

RegWrite does not exist in Kix so that is not going to work. It is called WriteValue in Kix.


Richard H.Administrator
(KiX Supporter)
2010-09-10 09:13 AM
Re: Write Registry Key based on Computername

It could be a problem with the script, or it could be a problem with the way that you are running it.

Basics first:
  1. Add some comment code to track the script processing.
  2. Log on to the MTSCApp* server using terminal services and open a command (DOS) prompt.
  3. Run the script from the command prompt using the same method and path as you would during logon.


If there is an error in the script or in the way that you are calling it then it will remain on screen and you will see it. You will also see the progress comments, so you will know that something is happening.

Here is an example:
 Code:
$sLNRegKey="HKEY_CURRENT_USER\Software\Lotus\Notes\8.0"
If InStr(@WKSTA,"MTSCApp")=1 AND @TSSESSION
	"This is a terminal server session on MTSCApp*"+@CRLF
	If InGroup("AltLNDrive")
		"This user is in group AltLNDrive"+@CRLF
		$=WriteValue($sLNRegKey, "NotesIniPath", "G:\Lotus\Notes\Data\notes.ini", "Reg_SZ")
		$=WriteValue($sLNRegKey, "NeedCommonFiles", 1, "Reg_DWord")
	Else
		"This user is not in group AltLNDrive"+@CRLF
		$=WriteValue($sLNRegKey, "NotesIniPath", "U:\Lotus\Notes\Data\notes.ini", "Reg_SZ")
		$=WriteValue($sLNRegKey, "NeedCommonFiles", 1, "Reg_DWord")
	EndIf
Else
	"This is not a terminal server session on MTSCApp*"+@CRLF
EndIf 

Exit 0


Glenn BarnasAdministrator
(KiX Supporter)
2010-09-10 12:52 PM
Re: Write Registry Key based on Computername

Take note of Richard's use of WriteValue, particularly when using REG_DWORD. A DWORD is a double-word number, and you were passing a string with many leading zeros. While it would not cause a script error, it's possible that it would not write the correct value to the registry.

Always, (no - ALWAYS!!!) run your scripts from a command line during testing, NEVER from the GUI/Explorer/Drag-n-Drop as you will miss all of the useful error and diag messages.

Glenn


JSP
(Fresh Scripter)
2010-09-10 07:20 PM
Re: Write Registry Key based on Computername

I ran the script from the command prompt (thanks for that little tip!), I get this error message when it gets to the new stuff I added.

Script error : xpression.
If LEFT(@WKSTA,7) = "mtscapp"
The system cannot find the path specified.

This is the new code I added:
 Code:
If LEFT(@WKSTA,7) = "mtscapp"
	If InGroup ("AltLNDrive")=1
		$=WriteValue("HKEY_CURRENT_USER\Software\Lotus\Notes\8.0", "NotesIniPath", "G:\Lotus\Notes\Data\notes.ini", "Reg_SZ")
 		$=WriteValue("HKEY_CURRENT_USER\Software\Lotus\Notes\8.0", "NeedCommonFiles", "00000001", "Reg_DWord")
	Else
		$=WriteValue("HKEY_CURRENT_USER\Software\Lotus\Notes\8.0", "NotesIniPath", "U:\Lotus\Notes\Data\notes.ini", "Reg_SZ")
 		$=WriteValue("HKEY_CURRENT_USER\Software\Lotus\Notes\8.0", "NeedCommonFiles", "00000001", "Reg_DWord")
		
	EndIf
EndIf


Glenn BarnasAdministrator
(KiX Supporter)
2010-09-10 07:31 PM
Re: Write Registry Key based on Computername

Try this to further isolate the error:
 Code:
If LEFT(@WKSTA,7) = 'mtscapp'
  If InGroup ('AltLNDrive')
'Writing NotesIniPath "A" :'
    $=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NotesIniPath', 'G:\Lotus\Notes\Data\notes.ini', 'Reg_SZ')
@SERROR ?
'Writing NeedCommonFiles "A": '
    $=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1, 'Reg_DWord')
@SERROR ?
  Else
'Writing NotesIniPath "B": '
    $=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NotesIniPath', 'U:\Lotus\Notes\Data\notes.ini', 'Reg_SZ')
@SERROR ?
'Writing NeedCommonFiles "B": '
    $=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1, 'Reg_DWord')
@SERROR ?
  EndIf
EndIf
Also, despite what you see in RegEdit, the value you need to write is 1, not "00000001"!

The debug messages will identify the step and grouping (A or B) and the result of each function. I don't indent temporary debug messages to keep them easy to find/remove later.

Glenn


JSP
(Fresh Scripter)
2010-09-10 07:55 PM
Re: Write Registry Key based on Computername

I get the same result.

Script error : xpression.
If LEFT(@WKSTA,7) = "mtscapp"
The system cannot find the path specified.

 Code:
If LEFT(@WKSTA,7) = 'mtscapp'
	If InGroup ('AltLNDrive')
		'Writing NotesIniPath "A" :'
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NotesIniPath', 'G:\Lotus\Notes\Data\notes.ini', 'Reg_SZ')
@SERROR ?
		'Writing NeedCommonFiles "A": '
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1', 'Reg_DWord')
@SERROR ?
	Else
		'Writing NotesIniPath "B": '
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NotesIniPath', 'U:\Lotus\Notes\Data\notes.ini', 'Reg_SZ')
@SERROR ?
		'Writing NeedCommonFiles "B": '
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1, 'Reg_DWord')
@SERROR ?
  	EndIf
EndIf

I added @SERROR after the 1st line and got this result:

Script error : xpression.
If LEFT(@WKSTA,7) = "mtscapp"

 Code:
If LEFT(@WKSTA,7) = 'mtscapp'
@SERROR ?
	If InGroup ('AltLNDrive')
		'Writing NotesIniPath "A" :'
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NotesIniPath', 'G:\Lotus\Notes\Data\notes.ini', 'Reg_SZ')
@SERROR ?
		'Writing NeedCommonFiles "A": '
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1', 'Reg_DWord')
@SERROR ?
	Else
		'Writing NotesIniPath "B": '
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NotesIniPath', 'U:\Lotus\Notes\Data\notes.ini', 'Reg_SZ')
@SERROR ?
		'Writing NeedCommonFiles "B": '
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1, 'Reg_DWord')
@SERROR ?
  	EndIf
EndIf


AllenAdministrator
(KiX Supporter)
2010-09-10 08:36 PM
Re: Write Registry Key based on Computername

When you are at the command line... what are you typing to start your script?

Also, add the following line to the very top of your script and tell us your result.

? @kix


Glenn BarnasAdministrator
(KiX Supporter)
2010-09-10 10:05 PM
Re: Write Registry Key based on Computername

What are you using to edit your script source?

G-


JSP
(Fresh Scripter)
2010-09-10 10:18 PM
Re: Write Registry Key based on Computername

The kixtart script is called from a batch file (This is the batchfile Active Directory calls when the user logs in), here's the batch file code:

 Code:
@echo ***********************************************************
@echo *                 Everett Charles Technologies            *
@echo *                  Client/Server Logon Screen             *
@echo ***********************************************************


:start
cls
echo off
net time /domain:stg /set /yes
rem echo The network is performing an inventory on your system...
rem echo Please wait...
wscript %0\..\iecache-1mb.vbs
rem \\hei01mis01\Inventory$\ocsinventory.exe

:oscheck
if "%OS%"=="Windows_NT" goto Winnt
endif
rem %0\..\vplogon.bat

:Win95
net use i: \\hei01file02\sales
net use j: \\hei01file02\datahabitat
net use l: \\hei01file02\cam
net use n: \\hei01mis01\mis
net use o: \\hei01pdc01\ftp
net use p: \\hei01file02\company
net use q: \\hei01file02\design
net use s: \\hei01file02\aoi
net use u: /home
net use v: \\hei01file03\cam
goto usercheck

:winnt
%0\..\Kix32.exe kixtart.kix

goto end

:usercheck
if "%username%"=="topdog" goto administrator endif
goto end

:administrator
net use /delete n: /yes
net use n: \\hei01file02\mis /persistent:no
net use /delete t: /yes
goto end

:end


This is the whole Kixtart Script:

 Code:
 ;**** Created with KiXscripts Editor | http://KiXscripts.com ****
;**** Last Modified on 3/20/2009 at 8:56:00 AM by SuperJeffie ****

;************************************************************
;** Script:		Login Screen
;** Version:	2.1
;** Created:	April 17, 2001
;**
;** Author:		Keith Judy
;** E-mail:		xx@xxxxxx-xxxxxxx.com
;**
;** Purpose / Comments:
;**
;**		Show a splash page while the user is logging in.
;**
;**
;************************************************************
; Your institutions name goes here
$Title = "MultiTest/STG - Harbor Electronics Network Login"

;************************************************************
;** Script Start
;**

; Turn break on

Break On 
SetTime "*"
; Start of Script
:MAIN
	
	; Set output to ASCII
	Dim $PreviousASCIIState
	$PreviousASCIIState = SetASCII ("on")	
	
	; Clear the screen
	CLS
 
	; Show the splash screen
	Gosub SPLASH_SCREEN
	
	; Progress meter init 
	;	NOTE: A Full bar is 34
	$Progress 		= 0	
	$AjustProgress	= 0
	
	;
	; Do something...
	;
	
	Sleep 1
	
	; Update progress bar
	$AjustProgress = 10  ; add 10 blocks
	Gosub DRAW_PROGRESS
	
	;
	; Do something else...
	;      
	
	Sleep 1
	
	; Update progress bar	
	$AjustProgress = 10  ; add 10 more blocks
	Gosub DRAW_PROGRESS
		
	;
	; Do something else, again...
	;
	
	Sleep 1
	
	; Update progress bar
	$AjustProgress = 14  ; were done
	Gosub DRAW_PROGRESS
	
	; Reset the output mode
	$X = SetASCII ($PreviousASCIIState)
	
	; Clear the screen again
	CLS	
Cookie1		
Exit 
; Quit

;************************************************************
;** Script Subroutines ( GOSUBs )
;**

; Draw screen information
:SPLASH_SCREEN

	; Background grid
	Color B+/N
	Box (0, 0, 24, 79, GRID)			
	
	; Title banner
	Color B/N
	Box (3, 3, 5, Len ($Title + 8) + 5, Å) ; shadow
	Color G+/N
	Box (2, 2, 4, Len ($Title + 8) + 4, FULL) ; box	
	
	; Information box
	Color B/N
	Box (8, 21, 18, 61, Å) ; shadow
	Color G+/N
	Box (7, 20, 17, 60, FULL) ; box
		
	; Draw the progress bar
	Color B/N
	Box (20, 21, 22, 61, Å) ; shadow
	Color G+/N
	Box (19, 20, 21, 60, FULL) ; box
	
	; Center the title on the screen
	Color Y+/N
	At ( 3, 4) $Title
	
	; Display some text strings
	Color W+/N
    At ( 9, 25) "Userid       : "
    At (10, 25) "Full name    : "
    At (11, 25) "Privilege    : "
    At (12, 25) "Workstation  : "
    At (13, 25) "Domain       : "
    At (14, 25) "Logon Server : "
    At (15, 25) "IP Address   : "
	
	; ...and some macro's
	Color Y+/N
	At ( 9, 40) @USERID
	At (10, 40) @FULLNAME
	At (11, 40) @PRIV
	At (12, 40) @WKSTA
	At (13, 40) @DOMAIN
	At (14, 40) @LSERVER
	At (15, 40) @IPADDRESS0
Sleep 1

:mapping
; Clear Mapped volumes/drives
Use i: /delete
;DelKey("hkey_current_user\network\persistent\i")
Use j: /delete
;DelKey("hkey_current_user\network\persistent\j")
Use k: /delete
;DelKey("hkey_current_user\network\persistent\k")
Use l: /delete
;DelKey("hkey_current_user\network\persistent\l")
Use n: /delete
;DelKey("hkey_current_user\network\persistent\n")
Use o: /delete
;DelKey("hkey_current_user\network\persistent\o")
Use p: /delete
;DelKey("hkey_current_user\network\persistent\p")
Use q: /delete
;DelKey("hkey_current_user\network\persistent\q")
Use r: /delete
;DelKey("hkey_current_user\network\persistent\r")
Use s: /delete
;DelKey("hkey_current_user\network\persistent\s")
Use t: /delete
;DelKey("hkey_current_user\network\persistent\t")
Use v: /delete
;DelKey("hkey_current_user\network\persistent\v")
Use w: /delete
;DelKey("hkey_current_user\network\persistent\w")
Use x: /delete
;DelKey("hkey_current_user\network\persistent\x")  
Use z: /delete
;DelKey("hkey_current_user\network\persistent\z")    
                                 
; Map common network volumes/drives
Use p: "\\hei01file02\company"

If @USERID = 'strawboss'
	Use m: "\\stgazfile01\users"
	Use n: "\\stgazts01\IT"
	Use o: "\\stgscfile02\IT"
		EndIf

If @USERID = 'pphasouk'
	Use h: "\\Ectazdata\DesignJobs"
	Use m: "\\cam01az\Genesis"
	Use n: "\\stgazfile01\Cam"
	Use s: "\\stgazfile01\Common"
		EndIf

If @USERID = 'tbleakley'
	Use w: "\\stgscfile02\18.ASSEMBLY"
	Use s: "\\hei02file01\Common"
		EndIf

If @USERID = 'KronosAdmin'
	Use o: "\\hei01file02\kronos_backup"
		EndIf

If @USERID = 'djohnson'
	Use u: "\\hei01file01\users\djohnson"
	Use x: /delete
		EndIf


; S: drives for Scanners

If @USERID = 'tmcnulty'
	Use s: "\\hei01file01\scans\tim"
	Use t: "\\stgscts01\ftp\tim"
		EndIf

If @USERID = 'kpau'
	Use s: "\\hei01file01\scans\Katrina"
		EndIf

If @USERID = 'lmendoza'
	Use s: "\\hei01file01\scans\lupe"
		EndIf

If @USERID = 'lcabael'
	Use l: "\\hei01file01\scans\larissa"
		EndIf

If @USERID = 'gbadhesa'
	Use s: "\\hei01file01\scans\Intel-CS"
	Use t: "\\hei02ftp01\ftp" /user:ftpuser /Password:"password"
		EndIf

If @USERID = 'majohnson'
	Use s: "\\hei01file01\scans\Intel-CS"
		EndIf

If @USERID = 'mdias'
	Use s: "\\hei01file01\scans\Intel-CS"
		EndIf


If @USERID = 'aterrell'
	Use s: "\\hei01file01\scans\april"
		EndIf

If @USERID = 'carteaga'
	Use s: "\\hei01file01\scans\cynthiaa"
		EndIf

If @USERID = 'edh'
	Use q: "\\hei01file01\scans\edh"
		EndIf

;End of S: Drives

If @USERID = 'testroom'
	Use n: "\\hei01file03\atg_jobs"
	Use k: "\\hei01file03\cam\atg_fault files"
		EndIf

If @USERID = 'ectacct'
	Use l: "\\w01acct02\d"
		EndIf

If @USERID = 'routing'
	Use s: /delete
	Use s: "\\10.0.0.24\genesis_archive"

		EndIf


If @USERID = 'drillterm'
	Use s: /delete
	Use s: "\\10.0.0.24\genesis_archive"

		EndIf

If @USERID = 'conceptdrill'
	Use f: /delete
	Use f: "\\ultraser\drillfiles"

		EndIf

If @USERID = 'hzelic'
	Use k: /delete
	Use k: "\\fls-tester\e$"
	Use l: /delete
	Use l: "\\fls-tester\c$"

		EndIf

If @USERID = 'agreen'
	Use t: "\\hei02ftp01\ftp" /user:ftpuser /Password:"password"
		EndIf


If @USERID = 'qcfinal'
	Use h: "\\ultraser\drillfiles"
		EndIf

If @USERID = 'epascual'
	Use s: "\\ectfs\acct\accounting"
		EndIf

If @USERID = 'bselfridge'
Use w: "\\stgscfile02\company\18.Assembly"
		EndIf

If @USERID = 'jferrell'
Use m: "\\stgscfile02\company\18.Assembly"
		EndIf

If @USERID = 'eurena'
Use z: "\\10.0.0.221\harborcam" /user:harborcam /Password:"password"
		EndIf

If @USERID = 'notesadmin'
Use f: "\\notes3\notesadmins"
		EndIf


	


; Map Group network volumes/drives
If InGroup ("Cam Users")=1 
	Use g: "\\ucam2k\plotjobs"
	Use h: "\\ultraser\drillfiles"
	Use i: "\\hei01file03\atg_Jobs"
	Use s: "\\10.0.0.24\genesis_archive"
	Use v: "\\hei01file04\frontline_valor"
	Use w: "\\10.0.0.24\frontline"
	Use x: "\\stgcc01\comm"
	Use z: "\\10.0.0.221\harborcam" /user:harborcam /Password:"password"

		EndIf


If InGroup ("HR-D")=1
	Use q: "\\w01acct02\D"

		EndIf


If InGroup ("ShippingGroup")=1
	Use s: "\\hei01file01\scans\shipping"
	Use q: "\\hei01dmz\FormFactorQuality"
		EndIf


If InGroup ("valor")=1 
Use s: /delete
	Use s: "\\10.0.0.24\genesis_archive"

		EndIf


If InGroup ("Genesis")=1
	Use f: /delete
	Use t: "\\valor\genesis" /user:starsys /Password:"password"
		EndIf

If InGroup ("Genesis Job")=1
	Use s: /delete
	Use s: "\\10.0.0.24\genesis_archive"

		EndIf

If InGroup ("ELD Group")=1
	Use j: "\\hei02ftp01\ftp" /user:ftpuser /Password:"password"
		EndIf

If InGroup ("AOI")=1 
	Use s: "\\hei01file02\aoi"
		EndIf

If InGroup ("QA Group - QC")=1 
	Use q: "\\hei01file01\quality"
		EndIf

If InGroup ("QA Group - QA")=1 
	Use t: "\\stgcc01\gentmp"
		EndIf

If InGroup ("Doc_Control")=1
	Use s: "\\hei01file01\Quality"
		EndIf

If @USERID = 'lcabael'
	Use q: "\\stgscts01\ftp"
		EndIf

If InGroup ("CAMFTP")=1
	Use q: "\\stgscts01\ftp"
		EndIf

If InGroup ("DesignGroup")=1

	Use r: "\\hei02file01\design"
	Use t: "\\hei02ftp01\ftp" /user:ftpuser /Password:"password"
	Use s: "\\hei02file01\SCD_Designs"
		EndIf

If InGroup ("HarborDesign")=1

	Use n: "\\stgscfile02\SCD_Designs"
		EndIf

If InGroup ("ELD Group")=1
	Use l: "\\hei01file02\PenangDesign"
	Use r: "\\hei02file01\design"
	Use t: "\\hei02ftp01\ftp" /user:ftpuser /Password:"password"

		EndIf

If InGroup ("HEIPenang")=1
	Use p: /delete
	Use p: "\\hei03exch02\PenangDesign"
	Use l: "\\hei01file02\PenangDesign"
	Use t: "\\hei02ftp01\ftp" /user:ftpuser /Password:"password"

		EndIf

If InGroup ("Sales STGSC")=1
	Use r: "\\hei01file02\sales"

		EndIf

If InGroup ("kronos")=1
	Use m: "\\hei01kronos\kronos1$"
	Use n: "\\hei01kronos\kronos2$"
	Use o: "\\hei01kronos\wfc"

		EndIf

If InGroup ("Domain Admins")=1
	Use r: "\\stgscfile02\IT"
		EndIf

If InGroup ("MIS")=1
	Use r: "\\stgscfile02\IT"
		EndIf

If InGroup ("WET")=1
	Use w: "\\hei01cam01\frontline"

		EndIf

If InGroup ("STGSG-FTP")=1
	Use z: "\\stgscts01\FTP\STGSG"

		EndIf

If InGroup ("AssemblyDrive")=1
	Use w: "\\stgscfile02\company\18.Assembly"
		EndIf

If InGroup ("MultiTest-CS")=1
	Use g: "\\stgscts01\ftp\mt-germany"
		EndIf

If InGroup ("CustomerService")=1 ;Tempe CS S: Drive
	Use s: "\\stgazfile01\common\Customer Service"
		EndIf

If @USERID = 'jferrell'
	Use l: /delete
	Use w: /delete
	Use l: "\\10.0.0.24\frontline"
	Use w: "\\stgscfile02\company\18.Assembly"
		EndIf



If InGroup ("EnableDrives")=1
	$ = WriteValue ("HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR", "Start", "3", "Reg_Dword")
		EndIf

If InGroup ("STGAZ Design Center Homepage")=1
	$ = WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main",
	 "Start Page", "http://estg/design/default.aspx", "Reg_SZ")
 	$ = WriteValue ("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main",
	 "Secondary Start Pages", "http://estgaz/Reports/Pages/Report.aspx?ItemPath=/eSTGSC/Design/TempeDesignSchedule",
	 "Reg_Multi_SZ")
		EndIf

If LEFT(@WKSTA,7) = 'mtscapp'
@SERROR ?
	If InGroup ('AltLNDrive')
		'Writing NotesIniPath "A" :'
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NotesIniPath', 'G:\Lotus\Notes\Data\notes.ini', 'Reg_SZ')
@SERROR ?
		'Writing NeedCommonFiles "A": '
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1', 'Reg_DWord')
@SERROR ?
	Else
		'Writing NotesIniPath "B": '
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NotesIniPath', 'U:\Lotus\Notes\Data\notes.ini', 'Reg_SZ')
@SERROR ?
		'Writing NeedCommonFiles "B": '
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1, 'Reg_DWord')
@SERROR ?
  	EndIf
EndIf




Return	
; Draw progress bar
:DRAW_PROGRESS

	; Setup progress bar ajustment
	$AjustProgress = $Progress + $AjustProgress	
	     
	; Bump progress up
	While $Progress <= $AjustProgress
		
		; Diplay curent progress
		Color Y+/N
		At (20, 22 + $Progress) Chr (219)	
		$Progress = $Progress + 1	
		
	Loop

	
Return



AllenAdministrator
(KiX Supporter)
2010-09-10 10:48 PM
Re: Write Registry Key based on Computername

There may be more sensitive info in this script but I modified the email address and replaced the passwords with "password".

JSP
(Fresh Scripter)
2010-09-10 11:51 PM
Re: Write Registry Key based on Computername

 Originally Posted By: Allen
There may be more sensitive info in this script but I modified the email address and replaced the passwords with "password".


Thanks, didn't even think to look for that. How do you get the code to go inside that box?


Glenn BarnasAdministrator
(KiX Supporter)
2010-09-11 01:41 PM
Re: Write Registry Key based on Computername

Use "code" tags - put the word "code" inside of square brackets at the beginning, and "/code" at the end - like this - [ code ] my program... [ /code ] - but without any spaces.

Still want to know what editor you use.

Glenn


AllenAdministrator
(KiX Supporter)
2010-09-12 01:41 AM
Re: Write Registry Key based on Computername

There so much code there... hard to tell if there are more but here is one mis-matched quote. Really no need for the quote around the 1.

 Code:
		'Writing NeedCommonFiles "A": '
		$=WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1, 'Reg_DWord')


Glenn BarnasAdministrator
(KiX Supporter)
2010-09-12 01:43 PM
Re: Write Registry Key based on Computername

That was my fault - I missed it when I removed the others while converting the "00000001" parameters to 1. I ran the code through Sanity and it found no errors other than a bunch of undeclared vars:
 Code:
(ICWD001) - C:\Temp>kgen testfile

KGen v2.4 - Kixtart script UDF linker
(C) 2000-2010 - Glenn Barnas / Inno-Tech Consulting

Searching for available UDFs.........................
 206 UDFs located in 131 files.
No UDFs needed for this generation!
Generation of t.KIX is complete!

Pass 1 : 520
Pass 2.

Warning: Undeclared variable.
              Variable Name: $Title
                In function: Main
         Referenced on line: 20
         Implicit declaration as GLOBAL!

Warning: Undeclared variable.
              Variable Name: $Progress
                In function: Main
         Referenced on line: 45
         Implicit declaration as GLOBAL!

Warning: Undeclared variable.
              Variable Name: $AjustProgress
                In function: Main
         Referenced on line: 46
         Implicit declaration as GLOBAL!

Warning: Undeclared variable.
              Variable Name: $X
                In function: Main
         Referenced on line: 79
         Implicit declaration as GLOBAL!

Warning: Undeclared variable.
              Variable Name: $
                In function: Main
         Referenced on line: 282
         Implicit declaration as GLOBAL!
Pass 3 : 520
Pass 4..
Pass 5 : 519
 5 warnings generated, 520 lines processed.
Can't/Won't run this on our network, but I'd break it down into sections for further testing.

Glenn

PS - I edited the original script post above to break 3 long lines.


ChristopheM
(Hey THIS is FUN)
2010-09-12 10:40 PM
Re: Write Registry Key based on Computername

Have a look at the attachment file.

All the configuration for mapping drive is in two ini files :
- one for users
- one for groups

for a new user, add a section [user-<userid>] and lines with format :
drive:=uncpath||user||password

(user and password are optional)

for a new group, add a new line in the groups section
then add a new section [group-<groupname>] and lines with same format than for user

i have not tested all the code because i'm not at the office.
i have just simulated some actions (InGroup, map and map /delete).


JSP
(Fresh Scripter)
2010-09-16 08:01 PM
Re: Write Registry Key based on Computername

I'm using notepad as the editor. It seems the problem is with
 Code:
If LEFT(@WKSTA,7) = 'mtscapp'


should mtscapp be in quotes or apostrophes?


Glenn BarnasAdministrator
(KiX Supporter)
2010-09-16 10:38 PM
Re: Write Registry Key based on Computername

Doesn't matter - Kix is happy with either. I asked about the editor because sometimes an editor will replace the quotes with "typographic" quotes - usually Word, Outlook, or Wordpad are the culprits.

Just for sanity - Try: If InStr(@WKSTA, 'mtscapp') = 1
This will test for the string's presence starting at position 1.

Glenn


JSP
(Fresh Scripter)
2010-09-17 04:39 PM
Re: Write Registry Key based on Computername

I get the following results:

┌┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┬┐
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼█ MultiTest/STG - Harbor Electronics Network Login █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█ █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█ Userid : █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█ Full name : █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█ Privilege : ADMIN █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█ Workstation : MTSCAPP01 █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█ Domain : STG █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█ Logon Server : \\STGDC01 █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█ IP Address : xxx. xx. xx. 47uccessfully.n completed s
The system cannot find the path specified. █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
L:\>┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█ █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤
└┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┘


Glenn BarnasAdministrator
(KiX Supporter)
2010-09-17 06:21 PM
Re: Write Registry Key based on Computername

Try this - I've eliminated the Gosubs, which can cause some strange errors if they aren't properly balanced. I've also cleaned up the code a tad, breaking it into 5 distinct functions - Splash(), ClearDriveMaps(), MapUserDrives(), MapGroupDrives, and OtherStuff().

Keep in mind that this is NOT how I'd create a loginscript, but trying to troubleshoot code based on a 10-year old design was not worth it. First off, I'd never put hard-coded parameters into a login script. This script impacts every user in the organization, and a single typo can create havoc. Our commercial script has no internal logic.. in fact, it's compiled so our customers can't change it if they wanted to. Everything is handled via an external config file. Take a look at the user manual on our web page to get an idea of how external configuration works. With that kind of technology, we can install our script in a client infrastructure, configure the INI file and be operational quickly.. minutes in a site of simple to moderate complexity.

Make sure to disable debugging by setting $DEBUG = 0 in the variable definition area!!!

Glenn
 Code:
;**** Last Modified on 3/20/2009 at 8:56:00 AM by SuperJeffie ****
;************************************************************
;** Script:		Login Screen
;** Version:	2.1
;** Created:	April 17, 2001
;**
;** Author:		Keith Judy
;** E-mail:		xx@xxxxxx-xxxxxxx.com
;**
;** Purpose / Comments:
;**
;**		Show a splash page while the user is logging in.
;**
;**
;************************************************************

; Turn break off  (should be OFF for login script!)
Break Off


; Declare variables
;************************************************************
Dim $Rc					; catch & discard return code
Dim $Title				; splash page title

Global $PROGRESS			; progress bar position
Global $DEBUG				; Debug flag




; Initialize variables
;************************************************************
; Your institutions name goes here
$Title = "MultiTest/STG - Harbor Electronics Network Login"

$DEBUG = 1
$PROGRESS = 0





If $DEBUG Break On EndIf		; allow break if debugging

$Rc = SetASCII("on")			; Set output to ASCII


; MAIN
;************************************************************

Splash($Title)				; Show the splash screen

ClearDriveMaps()			; Unmap prior drive mappings I: through Z:

MapUserDrives()				; map drives by user

MapGroupDrives()			; map drives by group

OtherStuff()				; could use a better name for this :)

DrawProgress(100)			; complete the progress bar

At(23,70) @CRLF				; leave cursor at bottom of screen
Quit 0




;************************************************************
;** Script Functions
;************************************************************



; DrawProgress(#)
;************************************************************
; Extend the progress bar by an increment amount, up to a limit of 37 positions
;
Function DrawProgress($_Inc)

  Dim $_ProgBar
  Dim $_I

  ; Create a full progress bar using the desired character
  For $_I = 1 to 40
    $_ProgBar = $_ProgBar + Chr(219)
  Next
  

  $PROGRESS = $PROGRESS + $_Inc			; increment progress bar
  $PROGRESS = IIF($PROGRESS>37, 37, $PROGRESS)	; limit to 37 positions

  ; Diplay curent progress
  Color Y+/N
  At(20, 22) Left($_ProgBar, $PROGRESS)

  If $DEBUG Sleep 0.75 EndIf			; slow down during debugging

  Exit 0

EndFunction



; Splash()
;************************************************************
; Draw splash screen & populate with information
;
Function Splash($_Title)

  Cls

  ; Background grid
  Color B+/N
  Box (0, 0, 24, 79, GRID)			
	
  ; Title banner
  Color B/N
  Box (3, 3, 5, Len ($_Title + 8) + 5, Å) ; shadow
  Color G+/N
  Box (2, 2, 4, Len ($_Title + 8) + 4, FULL) ; box	
	
  ; Information box
  Color B/N
  Box (8, 21, 18, 61, Å) ; shadow
  Color G+/N
  Box (7, 20, 17, 60, FULL) ; box
		
  ; Draw the progress bar
  Color B/N
  Box (20, 21, 22, 61, Å) ; shadow
  Color G+/N
  Box (19, 20, 21, 60, FULL) ; box
	
  ; Center the title on the screen
  Color Y+/N
  At ( 3, 4) $_Title
	
  ; Display some text strings
  Color W+/N
  At( 9, 25) 'Userid       : ' @USERID
  At(10, 25) 'Full name    : ' @FULLNAME
  At(11, 25) 'Privilege    : ' @PRIV
  At(12, 25) 'Workstation  : ' @WKSTA
  At(13, 25) 'Domain       : ' @DOMAIN
  At(14, 25) 'Logon Server : ' @LSERVER
  At(15, 25) 'IP Address   : ' @IPADDRESS0
	
  Exit 0

EndFunction


; ClearDriveMaps()
;************************************************************
;
Function ClearDriveMaps()

  DrawProgress(4)

  If Not $DEBUG
    ; Clear Mapped volumes/drives if not debugging
    Use i: /delete
    Use j: /delete
    Use k: /delete
    Use l: /delete
    Use n: /delete
    Use o: /delete
    Use p: /delete
    Use q: /delete
    Use r: /delete
    Use s: /delete
    Use t: /delete
    Use v: /delete
    Use w: /delete
    Use x: /delete
    Use z: /delete
  EndIf

  DrawProgress(4)

  Exit 0

EndFunction


Function MapUserDrives()

  If @USERID = 'strawboss'
    Use m: '\\stgazfile01\users'
    Use n: '\\stgazts01\IT'
    Use o: '\\stgscfile02\IT'
  EndIf

  If @USERID = 'pphasouk'
    Use h: '\\Ectazdata\DesignJobs'
    Use m: '\\cam01az\Genesis'
    Use n: '\\stgazfile01\Cam'
    Use s: '\\stgazfile01\Common'
  EndIf

  If @USERID = 'tbleakley'
    Use w: '\\stgscfile02\18.ASSEMBLY'
    Use s: '\\hei02file01\Common'
  EndIf

  If @USERID = 'KronosAdmin'
     Use o: '\\hei01file02\kronos_backup'
  EndIf

  If @USERID = 'djohnson'
    Use u: '\\hei01file01\users\djohnson'
    Use x: /delete
  EndIf

  DrawProgress(4)

; S: drives for Scanners
  If @USERID = 'tmcnulty'
    Use s: '\\hei01file01\scans\tim'
    Use t: '\\stgscts01\ftp\tim'
  EndIf

  If @USERID = 'kpau'
    Use s: '\\hei01file01\scans\Katrina'
  EndIf

  If @USERID = 'lmendoza'
    Use s: '\\hei01file01\scans\lupe'
  EndIf

  If @USERID = 'lcabael'
    Use l: '\\hei01file01\scans\larissa'
  EndIf

  If @USERID = 'gbadhesa'
    Use s: '\\hei01file01\scans\Intel-CS'
    Use t: '\\hei02ftp01\ftp' /user:ftpuser /Password:'password'
  EndIf

  If @USERID = 'majohnson'
    Use s: '\\hei01file01\scans\Intel-CS'
  EndIf

  If @USERID = 'mdias'
    Use s: '\\hei01file01\scans\Intel-CS'
  EndIf


  If @USERID = 'aterrell'
    Use s: '\\hei01file01\scans\april'
  EndIf

  If @USERID = 'carteaga'
    Use s: '\\hei01file01\scans\cynthiaa'
  EndIf

  If @USERID = 'edh'
    Use q: '\\hei01file01\scans\edh'
  EndIf

;End of S: Drives

  DrawProgress(4)

  If @USERID = 'testroom'
    Use n: '\\hei01file03\atg_jobs'
    Use k: '\\hei01file03\cam\atg_fault files'
  EndIf

  If @USERID = 'ectacct'
    Use l: '\\w01acct02\d'
  EndIf

  If @USERID = 'routing'
    Use s: /delete
    Use s: '\\10.0.0.24\genesis_archive'
  EndIf


  If @USERID = 'drillterm'
    Use s: /delete
    Use s: '\\10.0.0.24\genesis_archive'
  EndIf

  If @USERID = 'conceptdrill'
    Use f: /delete
    Use f: '\\ultraser\drillfiles'
  EndIf

  If @USERID = 'hzelic'
    Use k: /delete
    Use k: '\\fls-tester\e$'
    Use l: /delete
    Use l: '\\fls-tester\c$'
  EndIf

  If @USERID = 'agreen'
    Use t: '\\hei02ftp01\ftp' /user:ftpuser /Password:'password'
  EndIf


  If @USERID = 'qcfinal'
    Use h: '\\ultraser\drillfiles'
  EndIf

  If @USERID = 'epascual'
    Use s: '\\ectfs\acct\accounting'
  EndIf

  If @USERID = 'bselfridge'
    Use w: '\\stgscfile02\company\18.Assembly'
  EndIf

  If @USERID = 'jferrell'
    Use m: '\\stgscfile02\company\18.Assembly'
  EndIf

  If @USERID = 'eurena'
    Use z: '\\10.0.0.221\harborcam' /user:harborcam /Password:'password'
  EndIf

  If @USERID = 'notesadmin'
    Use f: '\\notes3\notesadmins'
  EndIf

  If @USERID = 'lcabael'
    Use q: '\\stgscts01\ftp'
  EndIf

  If @USERID = 'jferrell'
    Use l: /delete
    Use w: /delete
    Use l: '\\10.0.0.24\frontline'
    Use w: '\\stgscfile02\company\18.Assembly'
  EndIf

  DrawProgress(4)

  Exit 0

EndFunction
	

Function MapGroupDrives()

 If Not $DEBUG

  ; Map common network volumes/drives
  Use p: '\\hei01file02\company'

  ; Map Group network volumes/drives
  If InGroup('Cam Users')
    Use g: '\\ucam2k\plotjobs'
    Use h: '\\ultraser\drillfiles'
    Use i: '\\hei01file03\atg_Jobs'
    Use s: '\\10.0.0.24\genesis_archive'
    Use v: '\\hei01file04\frontline_valor'
    Use w: '\\10.0.0.24\frontline'
    Use x: '\\stgcc01\comm'
    Use z: '\\10.0.0.221\harborcam' /user:harborcam /Password:'password'
  EndIf


  If InGroup('HR-D')
    Use q: '\\w01acct02\D'
  EndIf


  If InGroup('ShippingGroup')
    Use s: '\\hei01file01\scans\shipping'
    Use q: '\\hei01dmz\FormFactorQuality'
  EndIf


  If InGroup('valor')
    Use s: /delete
    Use s: '\\10.0.0.24\genesis_archive'
  EndIf


  If InGroup('Genesis')
    Use f: /delete
    Use t: '\\valor\genesis' /user:starsys /Password:'password'
  EndIf

  If InGroup('Genesis Job')
    Use s: /delete
    Use s: '\\10.0.0.24\genesis_archive'
  EndIf

  If InGroup('ELD Group')
    Use j: '\\hei02ftp01\ftp' /user:ftpuser /Password:'password'
  EndIf

  If InGroup('AOI') 
    Use s: '\\hei01file02\aoi'
  EndIf

  If InGroup('QA Group - QC') 
    Use q: '\\hei01file01\quality'
  EndIf

  If InGroup('QA Group - QA') 
    Use t: '\\stgcc01\gentmp'
  EndIf

  If InGroup('Doc_Control')
    Use s: '\\hei01file01\Quality'
  EndIf

  If InGroup('CAMFTP')
    Use q: '\\stgscts01\ftp'
  EndIf

  If InGroup('DesignGroup')
    Use r: '\\hei02file01\design'
    Use t: '\\hei02ftp01\ftp' /user:ftpuser /Password:'password'
    Use s: '\\hei02file01\SCD_Designs'
  EndIf

  If InGroup('HarborDesign')
    Use n: '\\stgscfile02\SCD_Designs'
  EndIf

  If InGroup('ELD Group')
    Use l: '\\hei01file02\PenangDesign'
    Use r: '\\hei02file01\design'
    Use t: '\\hei02ftp01\ftp' /user:ftpuser /Password:'password'
  EndIf

  If InGroup('HEIPenang')
    Use p: /delete
    Use p: '\\hei03exch02\PenangDesign'
    Use l: '\\hei01file02\PenangDesign'
    Use t: '\\hei02ftp01\ftp' /user:ftpuser /Password:'password'
  EndIf

  If InGroup('Sales STGSC')
    Use r: '\\hei01file02\sales'
  EndIf

  If InGroup('kronos')
    Use m: '\\hei01kronos\kronos1$'
    Use n: '\\hei01kronos\kronos2$'
    Use o: '\\hei01kronos\wfc'
  EndIf

  If InGroup('Domain Admins')
    Use r: '\\stgscfile02\IT'
  EndIf

  If InGroup('MIS')
    Use r: '\\stgscfile02\IT'
  EndIf

  If InGroup('WET')
    Use w: '\\hei01cam01\frontline'
  EndIf

  If InGroup('STGSG-FTP')
    Use z: '\\stgscts01\FTP\STGSG'
  EndIf

  If InGroup('AssemblyDrive')
    Use w: '\\stgscfile02\company\18.Assembly'
  EndIf

  If InGroup('MultiTest-CS')
    Use g: '\\stgscts01\ftp\mt-germany'
  EndIf

  If InGroup('CustomerService') ;Tempe CS S: Drive
    Use s: '\\stgazfile01\common\Customer Service'
  EndIf

 EndIf ; debug

  DrawProgress(4)

  Exit 0

EndFunction

Function OtherStuff()

  Dim $_Rc

  If InGroup('EnableDrives')
    $_Rc = WriteValue ('HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\USBSTOR', 'Start', 3, 'Reg_Dword')
  EndIf

  If InGroup('STGAZ Design Center Homepage')
    $_Rc = WriteValue ('HKEY_CURRENT_USER\Software\Microhard\Internet Explorer\Main', 'Start Page', 'http://estg/design/default.aspx', 'Reg_SZ')
    $_Rc = WriteValue ('HKEY_CURRENT_USER\Software\Microhard\Internet Explorer\Main', 'Secondary Start Pages', 'http://estgaz/Reports/Pages/Report.aspx?ItemPath=/eSTGSC/Design/TempeDesignSchedule', 'Reg_Multi_SZ')
  EndIf


  DrawProgress(4)

  If LEFT(@WKSTA, 7) = 'mtscapp'
    If InGroup('AltLNDrive')
      'Writing NotesIniPath "A" :'
      $_Rc = WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NotesIniPath', 'G:\Lotus\Notes\Data\notes.ini', 'Reg_SZ')
      @SERROR ?
      'Writing NeedCommonFiles "A": '
      $_Rc = WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1, 'Reg_DWord')
      @SERROR ?
    Else
      'Writing NotesIniPath "B": '
      $_Rc = WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NotesIniPath', 'U:\Lotus\Notes\Data\notes.ini', 'Reg_SZ')
      @SERROR ?
      'Writing NeedCommonFiles "B": '
      $_Rc = WriteValue('HKEY_CURRENT_USER\Software\Lotus\Notes\8.0', 'NeedCommonFiles', 1, 'Reg_DWord')
      @SERROR ?
    EndIf
  EndIf

  DrawProgress(4)

  Exit 0

EndFunction


JSP
(Fresh Scripter)
2010-09-17 08:31 PM
Re: Write Registry Key based on Computername

Copied and ran your script, but got an error.


L:\>echo off
Current time at \\STGDC01 is 9/17/2010 11:28 AM

The command completed successfully.

Script error : unknown command !.
Splash($Title) ; Show the splash screen


L:\>


LonkeroAdministrator
(KiX Master Guru)
2010-09-17 08:52 PM
Re: Write Registry Key based on Computername

hmm...
 Code:
 Box (3, 3, 5, Len ($_Title + 8) + 5, Å) ; shadow


something just not right there. that most likely what errored it for you JSP \:\)


Glenn BarnasAdministrator
(KiX Supporter)
2010-09-18 10:08 PM
Re: Write Registry Key based on Computername

Ditch the bat file - also 10-year old procedures.. You don't really have Wintendo systems (Win9x), do you??? Same with the time sync - unneeded in an AD environment.

I just copied this, created LS.KIX and pasted the content into the file. Saved it and ran Kix32 LS.KIX and it worked flawlessly.

I'm running Kix 4.61, but also tested it with Kix 4.53, where it ran without error. Those are the only versions I'd consider using for login scripts.

Glenn


Glenn BarnasAdministrator
(KiX Supporter)
2010-09-18 10:12 PM
Re: Write Registry Key based on Computername

Nope - that's an optional character used in place of the 4 standard types that generates a shadow effect.

Glenn


JSP
(Fresh Scripter)
2010-09-21 09:48 PM
Re: Write Registry Key based on Computername

Unfortunately we still have a few Win9x machines, they run some manufacturing equipment, are from foreign vendors who either don't have software that will run on newer OS or the cost is prohibitive.

We are using Kixtart V3.63, and it's not really feasible to upgrade it right now.


LonkeroAdministrator
(KiX Master Guru)
2010-09-22 09:25 PM
Re: Write Registry Key based on Computername

btw glenn, I bet I could rewrite your "general" "non-editable" code into lonkenized couple line specific version ;\)