#199926 - 2010-09-16 08:01 PM
Re: Write Registry Key based on Computername
[Re: Allen]
|
JSP
Fresh Scripter
Registered: 2010-09-01
Posts: 12
Loc: Phoenix AZ
|
I'm using notepad as the editor. It seems the problem is with
If LEFT(@WKSTA,7) = 'mtscapp'
should mtscapp be in quotes or apostrophes?
|
Top
|
|
|
|
#199942 - 2010-09-17 04:39 PM
Re: Write Registry Key based on Computername
[Re: Glenn Barnas]
|
JSP
Fresh Scripter
Registered: 2010-09-01
Posts: 12
Loc: Phoenix AZ
|
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:\>┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀█┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█ █┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼█▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄█┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ ├┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┼┤ └┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┴┘
Edited by JSP (2010-09-17 04:41 PM)
|
Top
|
|
|
|
#199948 - 2010-09-17 06:21 PM
Re: Write Registry Key based on Computername
[Re: JSP]
|
Glenn Barnas
KiX Supporter
Registered: 2003-01-28
Posts: 4396
Loc: New Jersey
|
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;**** 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
_________________________
Actually I am a Rocket Scientist!
|
Top
|
|
|
|
#199951 - 2010-09-17 08:31 PM
Re: Write Registry Key based on Computername
[Re: Glenn Barnas]
|
JSP
Fresh Scripter
Registered: 2010-09-01
Posts: 12
Loc: Phoenix AZ
|
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:\>
|
Top
|
|
|
|
#200003 - 2010-09-21 09:48 PM
Re: Write Registry Key based on Computername
[Re: Glenn Barnas]
|
JSP
Fresh Scripter
Registered: 2010-09-01
Posts: 12
Loc: Phoenix AZ
|
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.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 507 anonymous users online.
|
|
|