#75111 - 2003-05-21 05:06 PM
Need Help with this Script
|
cmack0
Fresh Scripter
Registered: 2003-05-21
Posts: 5
|
I followed a Sample script that was posted on another site, and now this script does not work right... Some users aren't getting their S drives, some aren't mapping the alternate group mappings...and others work fine if I browse to the Netlogon share and run it manually. Workstations are a mix of 9x, w2k and xp, AD domain. There doesn't seem to be any pattern to this either.
;**** Created with KiXscripts Editor | http://KiXscripts.com **** ;**** Last Modified on 5/7/2003 at 3:45:40 PM by macalusoc ****
:Server_List ; Sets the Servers in use. $Server1 = "\\WMCFPS01\" $Server2 = "\\WMCFPS02\" $server3 = "\\ISMSD03\" $server4 = "\\COLD\" $server5 = "\\HOPE\" $server6 = "\\WMCAPP01\" $server7 = "\\Transplant_DC1\" $server8 = "\\WMCCHF01\"
CLS $section=1 ;Section 1 Color c+/n Box (9,29,15,46,single)
Color r+/n At (10,30) "Welcome to the," At (12,32) @domain At (12,37) "Domain" At (14,30) @fullname Sleep 1
Small Color b+/n Box (0,0,24,79,GRID) ; 'background grid' Color b/n Box (8,21,18,61,Å) ; 'shadow' of the box Color g+/n Box (7,20,17,60,FULL)
SetTime $Server3
Color w+/n At ( 9,25) "Userid : " ; display some text strings 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) "Current Time : " At (16,25) "Today's Date : "
Color y+/n At ( 9,40) @userid ; ...and some macro's At (10,40) @fullname At (11,40) @priv At (12,40) @wksta At (13,40) @domain At (14,40) @lserver At (15,40) @time At (16,40) @DATE Sleep 1.5
:set_vars $section=$section+1 ; Section 2 Use "*" /delete $h="\\wmcfps02\@userid" ;$s="\\wmcfps01\@PRIMARYGROUP"
CLS At (12,30) "Mapping Drives" Use b: /delete ;Use h: /delete ;Use s: /delete Use h: $h+"$" ;Use s: $s
:Departmental_Drive_Mappings $section=$section+1 ; Section 4 If InGroup ("AccountsPayable") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "AP" EndIf
If InGroup ("Admitting") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Admitting" EndIf
If InGroup ("AidsCare") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "AidsCare" EndIf
If InGroup ("AmbCare") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "AmbCare" EndIf
If InGroup ("AmbSurgery") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "AmbSurgery" EndIf
If InGroup ("Anesthesiology") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Anesthesiology" EndIf
If InGroup ("BHCGroup") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "BHC" EndIf
If InGroup ("Budget") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Budget" EndIf
If InGroup ("BurnCenter") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Burn" EndIf
If InGroup ("CHFGroup") CLS At (13,30) "Mapping Departmental Drives" Use s: $server8 + "RE Letters" EndIf
;If InGroup ("ChildLife") ; CLS ; At (13,30) "Mapping Departmental Drives" ; Use s: $server1 + "ChildLife" ; ;EndIf
;If InGroup ("ChildHosp") ; CLS ; At (13,30) "Mapping Departmental Drives" ; Use s: $server1 + "ChildHosp" ; ;EndIf
If InGroup ("Clinical Labs") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Labs" EndIf
If InGroup ("CPEP") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "BHC" EndIf
If InGroup ("CTS") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "CTS" EndIf
If InGroup ("Dentistry") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Dentistry" EndIf
If InGroup ("EmergencyRoom") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "ER" EndIf
If InGroup ("Eng") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Eng" EndIf
If InGroup ("Finance") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Finance" EndIf
If InGroup ("Food Svcs") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "FoodServices" EndIf
If InGroup ("GeneralAccounting") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "GenAcct" EndIf
If InGroup ("HeartCenter") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Heart" EndIf
If InGroup ("Human Resouces") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "HR" EndIf
If InGroup ("Infect Control") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Infection" EndIf
If InGroup ("Infosys") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Infosys" EndIf
If InGroup ("FireSafety") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "FireSafety" EndIf
If InGroup ("Law") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Law" EndIf
If InGroup ("Marketing") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Marketing" EndIf
If InGroup ("MaterialsMgt") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "MaterialsMgt" EndIf
If InGroup ("Matrix") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Matrix" EndIf
If InGroup ("Medical Records") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "MedRec" EndIf
If InGroup ("MFHA") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "MFHA" EndIf
If InGroup ("NeonatalGroup") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Neonatal" EndIf
If InGroup ("Neurophysiology") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Neurophys" EndIf
If InGroup ("Neuroscience") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "NeuroSurg" EndIf
If InGroup ("Nursing") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Nursing" EndIf
If InGroup ("OCCHealth") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "OCCHealth" EndIf
If InGroup ("Optho") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Optho" EndIf
If InGroup ("Orthopedics") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Orthopedics" EndIf
If InGroup ("PatientAccounts") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "PA" EndIf
If InGroup ("Pastoral Care") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Pastoral" EndIf
If InGroup ("PatRel") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "PatRel" EndIf
If InGroup ("PharmacyGroup") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Pharmacy" EndIf
If InGroup ("Planning") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Planning" EndIf
If InGroup ("ReEngineering") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "ReEngineering" EndIf
If InGroup ("Respiratory") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Respiratory" EndIf
If InGroup ("Quality Mngt") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Quality" EndIf
If InGroup ("RegulatoryAffairs") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "RegAff" EndIf
If InGroup ("RehabilitationGroup") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Rehabilitation" EndIf
If InGroup ("RiskManagement") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Risk" EndIf
If InGroup ("Security") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Security" EndIf
If InGroup ("Stat Flight") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Statflight" EndIf
If InGroup ("TCC") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "TCC" EndIf
If InGroup ("Telecomm") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Telecomm" EndIf
If InGroup ("Training") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Training" EndIf
If InGroup ("Transplant") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Transplant" EndIf
If InGroup ("Volunteer Svcs") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "Volunteer" EndIf
If InGroup ("WIHD") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "WIHD" EndIf
If InGroup ("WMCAdmin") CLS At (13,30) "Mapping Departmental Drives" Use s: $server1 + "WMCAdmin" EndIf
:Alternate_Mappings $section=$section+1 ; Section 5 If InGroup ("AltFireSafety") CLS At (13,30) "Mapping Additional Drives" Use t: $server1 + "FireSafety" EndIf
If InGroup ("AltBHC") CLS At (13,30) "Mapping Additional Drives" Use t: $server1 + "BHC" EndIf
If InGroup ("CHFGroup") CLS At (13,30) "Mapping Additional Drives" Use g: $server1 + "REDatabase" EndIf
If InGroup ("Citrix - Clickview") CLS At (13,30) "Mapping Additional Drives" Use c: $server1 + "clickview" EndIf
If InGroup ("Citrix - Clickview") CLS At (13,30) "Mapping Additional Drives" Use f: $server1 + "clickview" EndIf
If InGroup ("Citrix - Clickview") CLS At (13,30) "Mapping Additional Drives" Use r: $server1 + "f" EndIf
If InGroup ("Code808") CLS At (13,30) "Mapping Additional Drives" Use t: $server1 + "Code808" EndIf
If InGroup ("CTS") CLS At (13,30) "Mapping Additional Drives" Use n: $server1 + "CTS" EndIf
If InGroup ("CTS") CLS At (13,30) "Mapping Additional Drives" Use r: $server1 + "CTS_Shar" EndIf
If InGroup ("Food Svcs") CLS At (13,30) "Mapping Additional Drives" Use p: $server1 + "FTP_FoodServ" EndIf
If InGroup ("FTP_QCFTP") CLS At (13,30) "Mapping Additional Drives" Use u: $server2 + "FTP_QCFTP$" EndIf
If InGroup ("Infect Control") CLS At (13,30) "Mapping Additional Drives" Use r: $server4 + "IsolationRpt" EndIf
If InGroup ("Law") CLS At (13,30) "Mapping Additional Drives" Use f: $server1 + "Appslaw" EndIf
If InGroup ("Medical Records") CLS At (13,30) "Mapping Additional Drives" Use k: $server5 + "Apps" /persistant EndIf
If InGroup ("Medical Records") CLS At (13,30) "Mapping Additional Drives" Use L: $server5 + "Apps" /persistant EndIf
If InGroup ("Medical Records") CLS At (13,30) "Mapping Additional Drives" Use m: $server1 + "3MHIS" EndIf
If InGroup ("MFHA") CLS At (13,30) "Mapping Additional Drives" Use f: $server1 + "AppsMFHA" EndIf
If InGroup ("NeonatalGroup") CLS At (13,30) "Mapping Additional Drives" Use k: $server1 + "DE40" EndIf
If InGroup ("NeonatalGroup") CLS At (13,30) "Mapping Additional Drives" Use m: $server1 + "Logbook" EndIf
If InGroup ("NeonatalGroup") CLS At (13,30) "Mapping Additional Drives" Use n: $server1 + "Progress" EndIf
If InGroup ("NeonatalGroup") CLS At (13,30) "Mapping Additional Drives" Use o: $server1 + "Neonatal" EndIf
If InGroup ("NeonatalGroup") CLS At (13,30) "Mapping Additional Drives" Use r: $server1 + "Neonatal" EndIf
If InGroup ("Nursing") CLS At (13,30) "Mapping Additional Drives" Use f: $server1 + "AppsNursing" EndIf
If InGroup ("Nursing") CLS At (13,30) "Mapping Additional Drives" Use g: $server1 + "Grasp" EndIf
If InGroup ("Nursing") CLS At (13,30) "Mapping Additional Drives" Use l: $server1 + "Grasp2" EndIf
If InGroup ("Nursing") CLS At (13,30) "Mapping Additional Drives" Use q: $server6 + "cachesys" EndIf
If InGroup ("OCC-HR") CLS At (13,30) "Mapping Additional Drives" Use o: $server1 + "Shared with HR" EndIf
If InGroup ("ResearchGrants") CLS At (13,30) "Mapping Additional Drives" Use u: $server1 + "Researchgrants" EndIf
If InGroup ("RegulatoryAffairs") CLS At (13,30) "Mapping Additional Drives" Use f: $server1 + "AppsRegAff" EndIf
If InGroup ("Reliant") CLS At (13,30) "Mapping Additional Drives" Use r: $server1 + "Reliant" EndIf
If InGroup ("RiskManagement") CLS At (13,30) "Mapping Additional Drives" Use g: $server1 + "AppsRegAff" EndIf
If InGroup ("SilentType") CLS At (13,30) "Mapping Additional Drives" Use t: $server1 + "SilentType" EndIf
If InGroup ("SMSLIB") CLS At (13,30) "Mapping Additional Drives" Use g: $server1 + "SMSLIB" EndIf
If InGroup ("Trac") CLS At (13,30) "Mapping Additional Drives" Use t: $server1 + "Trac" EndIf
If InGroup ("Transplant") CLS At (13,30) "Mapping Additional Drives" Use g: $server7 + "Apps" EndIf
If InGroup ("WorkerInjuries") CLS At (13,30) "Mapping Additional Drives" Use o: $server1 + "Worker-Injuries" EndIf
;:Printers ;$section=$section+1 ; Section 6 ;If InGroup ("Infosys") ; CLS ; At (11,30) "Adding Printers" ; AddPrinterConnection ("\\WMCFPS01\IS_Rm_101") ; AddPrinterConnection ("\\WMCFPS01\InfoSys01") ; AddPrinterConnection ("\\WMCFPS01\InfoSys03") ; AddPrinterConnection ("\\WMCFPS01\InfoSys04") ; If SetDefaultPrinter ("\\WMCFPS01\IS_Rm_101")=0 ; At (13,30) "Default Printer IS_Rm_101" ; EndIf ;EndIf
:Desktop_Management $section=$section+1 ; Section 7 At (10,24) "Checking SMS Components" If Exist("%SYSTEMROOT%\MS\SMS\LOGS\CLICORE.LOG")=0 Shell @LDRIVE + "\SMSLS.BAT" EndIf
;CLS ;If @PRODUCTTYPE = "Windows 95" ;Color y+/b "OS is Windows 95 " ;Else ;If @PRODUCTTYPE = "Windows 98" ;Color r+/g "OS is Windows 98..." ;Else ;If @PRODUCTTYPE = "Windows 2000 Server" ;Color m+/n "OS is Windows 2000 Server!!!"
;Sleep 5
;:Securing_Station ;$section=$section+1 ; Section 8 ;CLS ;At (10,24) "Checking Screen saver. Please Wait" ;$act=ReadValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive") ;$sec=ReadValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaverIsSecure") ;If $act=1 AND $sec=1 ; GoTo Dontwrite ;Else ; GoTo Write ;EndIf ;
;:Write ;$section=$section+1 ; Section 9
;WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveActive","1","REG_SZ") ;WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaverIsSecure","1","REG_SZ") ;WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","ScreenSaveTimeOut","900","REG_SZ") ;WriteValue("HKEY_CURRENT_USER\Control Panel\Desktop","SCRNSAVE.EXE","c:\winnt\system32\SSPIPES.SCR","REG_SZ") ;WriteValue("HKEY_CURRENT_USER\Control Panel\Screen Saver.3DPipes","JointType","2","REG_SZ") ;If @ERROR = 0 CLS ; At (10,24) "Screen Saver updated" ;Else ; ;EndIf ;GoTo IE_Start_Page
;:Dontwrite ;$section=$section+1 ; Section 10 ;CLS ;At (10,24) "Screen Saver Already Set" ;Sleep 1
:IE_Start_Page $section=$section+1 ; Section 11 $home=ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main","Start Page") If $home<>"icare" GoTo Set_Home_Page Else GoTo end EndIf
:Set_Home_Page $section=$section+1 ; Section 12 If InGroup ("Domain Admins") GoTo END Else WriteValue("HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main","Start Page","icare","REG_SZ") EndIf
:END Exit
|
|
Top
|
|
|
|
#75112 - 2003-05-21 05:30 PM
Re: Need Help with this Script
|
Richard H.
Administrator
   
Registered: 2000-01-24
Posts: 4946
Loc: Leatherhead, Surrey, UK
|
You should metion which version(s) of KiXtart you are running on the clients, and which version(s) of the RPC service you are running on the login server(s).
As a start, after each "USE", check the value of @ERROR and report an error if it is set.
To reduce the amount of work (and make it easier for yourself in the future) use UDF's for common tasks like drive mapping and updating the message text. This will simplify the script, make it less prone to error and save you a lot of aggravation when you need to make changes.
For example, you could pass the group, drive letter, mapping and display comment to a UDF. The UDF will do the INGROUP check, display, mapping and checking of the success in one neat area.
Something simple like:
code:
Function MapDrive($sGroup,$sDrive,$sUNC,$sComment) If InGroup($sGroup) $sComment+@CRLF Use $sDrive /Delete /Persistent Use $sDrive $sUNC If @ERROR $=MessageBox("Cannot map "+$sDrive+" to "+$sUNC+@CRLF+@SERROR,"Map drive failure,48) EndIf EndIf EndFunction
You can now simplify your code to:
code:
MapDrive("Admitting","S:",$server1+"Admitting","Mapping departmental drive") MapDrive("AidsCare","S:",$server1+"AidsCare","Mapping departmental drive") MapDrive("CTS","R:",$server1+"CTS","Mapping additional drives")
And so-on.
|
|
Top
|
|
|
|
#75113 - 2003-05-21 05:39 PM
Re: Need Help with this Script
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
In your drive mappings, you could have one simple -
code:
CLS At (13,30) "Mapping Departmental Drives"
The section "Mapping additional Drives" is not really necessary, is it?
For example, you could cover this with -
code:
If InGroup ("Medical Records") Use k: $server5 + "Apps" /persistent Use L: $server5 + "Apps" /persistent Use m: $server1 + "3MHIS" Use s: $server1 + "MedRec" EndIf
Note: persistent is not persistant.
Also, with your IF INGROUP testing, you could simplify this with a SELECT..CASE INGROUP..ENDSELECT. The catch to this is that if you have any users that share multiple groups the SELECT..CASE.ENDSELECT will exit on the first true condition.
Please post you code using the "Code" button on the posting window.
Thanks,
Kent
|
|
Top
|
|
|
|
#75115 - 2003-05-21 05:44 PM
Re: Need Help with this Script
|
Kdyer
KiX Supporter
   
Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
|
One additional thought from the KiXtart Documentation -
quote:
On Windows 9x clients, INGROUP works on local groups only if the KiXtart RPC service is running.
Again, this is covered in the FAQ Forum on this website.
Kent [ 21. May 2003, 17:45: Message edited by: kdyer ]
|
|
Top
|
|
|
|
#75117 - 2003-05-21 06:50 PM
Re: Need Help with this Script
|
cmack0
Fresh Scripter
Registered: 2003-05-21
Posts: 5
|
Thanks for all the suggestions, obviously this needs work, and I am still a bit new to this. The version of kix is 4.20, kxrpc is 4.1.0, I have a batch script running now to deploy the rpc service to the 9x machines. I guess I should look more at UDFs to simplify things first, alot of what is in here is from what someone else was doing in a .bat file, so I just duplicated it here (timesync, persistent mappings, etc). Where is the best place to get more info on UDFs? I'm not exactly sure how they even work at this point...
Thanks again.
|
|
Top
|
|
|
|
#75119 - 2003-05-22 03:47 PM
Re: Need Help with this Script
|
cmack0
Fresh Scripter
Registered: 2003-05-21
Posts: 5
|
Why does the FAQ forum suggest that the rpc service can be installed on EITHER workstation or Domain controller? Does it just need to be in the netlogon directory, or do you need to regsrv the DLLs?
|
|
Top
|
|
|
|
#75121 - 2003-05-22 03:56 PM
Re: Need Help with this Script
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
KXRPC is an program that runs as an NT service. It does not require the KX??.DLLs.
The KXRPC service is best if installed on your logon domain DCs, but can be installed on an NT workstation if you direct the Win9x clients to this device. This is discussed in the KiXtart Manual.
Win9x clients query domain information via the kx95.dll which communicates with the KXRPC service. You have various methods to configure the client to tell it where the KXRPC service is located. KiXtart will look for the KXRPC service on the logon server by default. Again see the manual.
Win9x can run an NT service anyway. [ 22. May 2003, 16:01: Message edited by: Howard Bullock ]
|
|
Top
|
|
|
|
#75122 - 2003-05-22 05:51 PM
Re: Need Help with this Script
|
cmack0
Fresh Scripter
Registered: 2003-05-21
Posts: 5
|
OK, I had my files confused, I currently have the kix32.exe and the required DLLs being copied to the windows directory on the 9x workstations, and to the systemroot of nt systems. I also went back and RE-READ the manual and found the info on installing the RPC service(Way in the back of the manual). So the RPC service is currently running on the logon servers. This alone should help with some of my issues. What I'm not clear on from the manual, is how to deal with group memberships in 9x environment, Will the rpc service allow me to use my Domain group names for mapping 9x systems? Thanks again...
|
|
Top
|
|
|
|
#75124 - 2003-05-22 06:15 PM
Re: Need Help with this Script
|
cmack0
Fresh Scripter
Registered: 2003-05-21
Posts: 5
|
All my groups are global, we do have some workstations with Novell client running IPX. We are in the process of migrating from Novell to W2K.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
1 registered
(Allen)
and 1198 anonymous users online.
|
|
|