#73517 - 2003-03-04 05:34 PM
Re: Problem with kixtart and NT4.0
|
DJ Ballistic
Starting to like KiXtart
Registered: 2003-02-21
Posts: 185
|
Sorry to sound like I am beating on an old drum here is my login script:
Kixtart.kix
code:
;**** Created with KiXscripts Editor | http://KiXscripts.com **** ;**** Last Modified on 3/4/2003 at 9:50:46 AM by mmontgomery **** ; Revised By Matthew T. Montgomery (mmontgomery@sussexcounty.net)
;? 'Error = '+@ERROR+' - '+@SERROR ;Error checking per line
;******************************************************************** ;Copy My Computer Information.kix Shortcut To The Client PC's Desktop ;********************************************************************
;MD c:\Kixscripts ;If NOT Exist('c:\Kixscripts\kix32.exe') ;Copy '\\sussex1\netlogon\kix32.exe' 'c:\Kixscripts' ;EndIf ;If NOT Exist('c:\Kixscripts\My Computer Info.kix') ;Copy '\\sussex1\netlogon\My Computer Information.kix' 'c:\Kixscripts' ;EndIf $desktop = ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Desktop") If NOT Exist('$desktop\My Computer Information.lnk') Copy '\\sussex1\netlogon\My Computer Information.lnk' '$desktop' EndIf
;********************************************************************************** ;Creates Admin Directory On Client PC and Copies Exchange Profile Creation Shortcut ;********************************************************************************** MD C:\Admin $desktop = ReadValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders","Desktop") If NOT Exist('$c:\Admin\Exchange Profile.lnk') Copy '\\sussex1\netlogon\Exchange Profile.lnk' 'c:\Admin' EndIf
;****************************************************************************** ; Check the following key for W2k Machines to make the window not run minimized ;******************************************************************************
If @dos >= "5.0" $hklms = 'HKEY_LOCAL_MACHINE\SOFTWARE' If 1 <> ReadValue($hklms+"\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync") $ = WriteValue ($hklms+"\Microsoft\Windows NT\CurrentVersion\Winlogon", "RunLogonScriptSync", "1", "REG_DWORD") EndIf EndIf
;************************************************************ ;Windows MessageBox To Greet The User And Display Information ;************************************************************
MessageBox(" Hello @FULLNAME - today is @DAY @MDAYNO @MONTH
*** You are logging onto the @DOMAIN Domain *** Your current user rights are @Priv Your Password will expire in @PWAGE days. Host Name: @HOSTNAME IP address: @IPADDRESS0 Your System Specifications = @PRODUCTTYPE, @MHZ Mhz @CPU","Sussex Domain Logon",64,5)
; ------------------------------------------------------------------------ ; @MHZ = processor speed ; @CPU = processor type ; @TIME = curent time ; @fullname = shows users full name as entered on Server logon credentials ; @wksta = workstation name as entered on the local PC ; ------------------------------------------------------------------------
;*********************************** ; Synchronize Time From "Sussex-DC1" ;*********************************** SetTime "\\SUSSEX-DC1"
;***************** ;Clears The Screen ;***************** CLS
;*************************************************** ;Disables The Ability To Interrupt The Script Window ;*************************************************** Break off
;*********************************** ;Deletes all currently mapped drives ;*********************************** Use "*" /DELETE
;******************************************* ; Network Drive Mappings by Group Membership ;******************************************* If InGroup('Domain Users') ? 'I: (\\Sussex-FS-1\General)' Use I: '\\Sussex-FS-1\General' ? 'P: (\\Sussex1\Users\@USERID)' Use P: '\\Sussex1\USERS\@USERID' ? 'S: (\\Sussex1\Shared)' Use S: '\\Sussex1\Shared' EndIf
If InGroup('Information Systems') ? 'W: (\\Sussex-FS-2\Information Systems)' Use W: '\\Sussex-FS-2\Information Systems' EndIf
If InGroup('Mapping And Addressing') ? 'G: (\\Sussex1\Global)' Use G: '\\Sussex1\Global' ? 'R: (\\Sussex1\ReAddressing)' Use R: '\\Sussex1\ReAddressing' ? 'V: (\\Sussex1\View)' Use V: '\\Sussex1\View' ? 'Z: (\\Sussex-fs-1\Aerial_Photos)' Use Z: '\\Sussex-fs-1\Aerial_Photos' EndIf
;************************************ ;Printer Mappings by Group Membership ;************************************ If InGroup('Information Systems') $RC=AddPrinterConnection("\\Sussex-DC2\IS HP LaserJet 4100tn") If $RC=0 ? "Adding printer, IS HP LaserJet 4100tn" ;Added 03/01/2003 EndIf $RC=AddPrinterConnection("\\Sussex-DC2\IS HP Color LaserJet 4550") If $RC=0 ? "Adding printer, IS HP Color LaserJet 4500" Else ? "$$RC = "+$RC ? "@@Error = "+@Error ? "@@SError = "+@SError EndIf EndIf
;******************************************************** ;Script Window Stays Focused For Specified Amount Of Time ;******************************************************** Sleep 2 ; Wait for 2 sec
;*********************** ;Exits The Script Window ;*********************** Exit
This all works if the script actually runs.
Here is the logon.bat I created to try to call the script:
code:
@ECHO off SETLOCAL
VER | find "NT" > nul IF not errorlevel 1 GOTO Win_NT
VER | find "2000" > nul IF not errorlevel 1 GOTO Win_NT
VER | find "XP" > nul IF not errorlevel 1 GOTO Win_NT
VER | find "98" > nul IF not errorlevel 1 GOTO Win_9X
VER | find "95" > nul IF not errorlevel 1 GOTO Win_9X
GOTO unknown_os
:win_NT call kix32.exe kixtart.kix goto end
:win_9X %0\..\kix.exe %0\..\kix32.exe myscript.scr goto end
:unknown_os :end
It seems to work okay too I am not sure. I haven't changed it to try to work with 9x clients yet so the "myscript.scr" is still in there.
I created this ldap.kix script
code:
;**** Created with KiXscripts Editor | http://KiXscripts.com **** ;**** Last Modified on 3/4/2003 at 11:33:23 AM by mmontgomery ****
$DN = TranslateName (3, "", 3, "@LDomain\@userid", 1) ? "DN = " + $DN[0]? "Error = " + $DN[1] ? "ErrorText = " + $DN[2]
Doesn't work when I run it alone. I tried creating a batch file to call it as well
code:
KIX32.EXE ldap.kix
It doesn't work at all.
I need a stiff drink.
|
Top
|
|
|
|
#73518 - 2003-03-04 05:36 PM
Re: Problem with kixtart and NT4.0
|
DJ Ballistic
Starting to like KiXtart
Registered: 2003-02-21
Posts: 185
|
Actually my administrative experience is quite extensive. I am an MCDBA and an MCSA. I however am completely new to the kixtart scripting and have never done it before so in communicating with you guys that are more experienced it is hard for me to understand what you mean. The manual isn't helping me, I have read it and read it. It seems that I have a more complex environment that the manual covers.
|
Top
|
|
|
|
#73521 - 2003-03-04 05:40 PM
Re: Problem with kixtart and NT4.0
|
DJ Ballistic
Starting to like KiXtart
Registered: 2003-02-21
Posts: 185
|
ok I have domain admin rights on the domain. I can run the script. I need to run this on the domain controller right? If so how do I call it? That is my problem right now. I just can't run the .kix file it doesn't know what to do with it. And I can't just run kix32 because it will default to the kixtart.kix file which isn't the issue. I tried making a batch file to run the ldap.kix script and it isn't working. That is what I am trying to say.
|
Top
|
|
|
|
#73522 - 2003-03-04 05:41 PM
Re: Problem with kixtart and NT4.0
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
OK there appears to be a typo in the sample ldap.kix script. Two lines are concatenated
There should be the function call and then three lines that begin with a question mark.
Include the UDF TranslateName() under these fours lines.
Execute the script using the command line "kix32.exe ldap.kix"
You should get three lines of output.
DN = ... Error = ... ErrorText = ...
|
Top
|
|
|
|
#73523 - 2003-03-04 05:43 PM
Re: Problem with kixtart and NT4.0
|
Sealeopard
KiX Master
Registered: 2001-04-25
Posts: 11164
Loc: Boston, MA, USA
|
Command prompt (adjust for correct directories):
code:
d:\temp\ldap\kix32.exe d:\temp\ldap\ldap.kix
LDAP.KIX:
code:
$DN=TranslateName(3, "", 3, "@LDomain\@userid", 1) ? "DN = " + $DN[0] ? "Error = " + $DN[1]? "ErrorText = " + $DN[2] exit 0 ;FUNCTION TranslateName() ; ;AUTHOR Howard A. Bullock (hbullock@tycoelectronics.com) ; ;VERSION 2.0 ; ;ACTION Translates from one name type to another. Good for converting an NT4 name ; like domain\user into an LDAP distinguished name or the reverse. ; ;SYNTAX TranslateName ($InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType) ; ;PARAMETERS $InitType (Required) ; - Integer value ; 1 = ADS_NAME_INITTYPE_DOMAIN ; Initializes a NameTranslate object by setting the domain that the object will bind to. ; ; 2 = ADS_NAME_INITTYPE_SERVER ; Initializes a NameTranslate object by setting the server that the object will bind to. ; ; 3 = ADS_NAME_INITTYPE_GC ; Initializes a NameTranslate object by locating the global catalog that the object will bind to. ; ; $BindName (Required) ; - String value ; If an $InitType = 3 (ADS_NAME_INITTYPE_GC), then the $BindName = "". ; InitTypes 1 and 2 require a name of a domain or server to be input. Note: "" may default ; to the current server or domain. ; ; $LookupNameType (Required) ; - Integer value ; ; $LookupName (Required) ; - String value see below ; ; $ReturnNameType (Required) ; - Integer value see below ; ; Documentation of Name Types. Lookup the more info on http://MSDN.Microsoft.com ; Not all name types work. The two that have been most useful to are "1" and "3" ; ; 1 = ADS_NAME_TYPE_1779 ; Name format as specified in RFC 1779. For example, "CN=Jane Doe,CN=users, DC=Microsoft, DC=com". ; ; 2 = ADS_NAME_TYPE_CANONICAL ; Canonical name format. For example, "Microsoft.com/Users/Jane Doe". ; ; 3 = ADS_NAME_TYPE_NT4 ; Account name format used in Microsoft® Windows© NT® 4.0. For example, "Microsoft\JaneDoe". ; ; 4 = ADS_NAME_TYPE_DISPLAY ; Display name format. For example, "Jane Doe". ; ; 5 = ADS_NAME_TYPE_DOMAIN_SIMPLE ; Simple domain name format. For example, "JaneDoe@Microsoft.com". ; ; 6 = ADS_NAME_TYPE_ENTERPRISE_SIMPLE ; Simple enterprise name format. For example, "JaneDoe@Microsoft.com". ; ; 7 = ADS_NAME_TYPE_GUID ; Global Unique Identifier format. For example, {95ee9fff-3436-11d1-b2b0-d15ae3ac8436}. ; ; 8 = ADS_NAME_TYPE_UNKNOWN ; Unknown name type. The system will try to make the best guess. ; ; 9 = ADS_NAME_TYPE_USER_PRINCIPAL_NAME ; User principal name format. For example, "JaneDoe@Fabrikam.com". ; ; 10 = ADS_NAME_TYPE_CANONICAL_EX ; Extended canonical name format. For example, "Microsoft.com/Users Jane Doe". ; ; 11 = ADS_NAME_TYPE_SERVICE_PRINCIPAL_NAME ; Service principal name format. For example, "www/www.microsoft.com@microsoft.com" ; ; 12 = ADS_NAME_TYPE_SID_OR_SID_HISTORY_NAME ; A SID string, as defined in the Security Descriptor Definition Language (SDDL), for either ; the SID of the current object or one from the object's SID history. ; For example, "O:AOG:DAD:(A;;RPWPCCDCLCSWRCWDWOGA;;;S-1-0-0)" For more information see ; Security Descriptor String Format under "Security" in the Microsoft Platform SDK documentation. ; ;REMARKS Not name types seem to work. ; ;RETURNS This function returns an ARRAY of three values: ; Name of the type specified by $ReturnNameType (String) ; Error number (Long Integer) ; Error text (String). ; ;DEPENDENCIES OS: Active Directory aware client ; ;EXAMPLES $DN = TranslateName (3, "", 3, "@Domain\@wksta$", 1) ; ? "DN = " + $DN[0] ; ? "Error = " + $DN[1] ; ? "ErrorText = " + $DN[2] ; ; $DN = TranslateName (3, "", 3, "@LDomain\@userid", 1) ; ? "DN = " + $DN[0] ; ? "Error = " + $DN[1] ; ? "ErrorText = " + $DN[2] ; ; Function TranslateName ($InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType)
Dim $InitType, $BindName, $LookupNameType, $LookupName, $ReturnNameType Dim $NameTranslate, $ReturnName, $Error, $ErrorText
$Error = 0 $ErrorText = "" $ReturnName = "" $NameTranslate = CREATEOBJECT ("NameTranslate") $Error = @error $ErrorText = @serror if $Error = 0 $NameTranslate.Init ($InitType, $BindName) $Error = @error $ErrorText = @serror if $Error = 0 $NameTranslate.Set ($LookupNameType, $LookupName) $Error = @error $ErrorText = @serror if $Error = 0 $ReturnName = $NameTranslate.Get($ReturnNameType) $Error = @error $ErrorText = @serror endif endif endif $TranslateName = $ReturnName, $Error, $ErrorText Endfunction
[ 04. March 2003, 17:46: Message edited by: sealeopard ]
_________________________
There are two types of vessels, submarines and targets.
|
Top
|
|
|
|
#73524 - 2003-03-04 05:45 PM
Re: Problem with kixtart and NT4.0
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
You can execute this on your workstation, but you will have to make sure that KiXtart is in the current directory, in the %PATH%, or use fully qualified paths to both KiX32 and your script.
|
Top
|
|
|
|
#73525 - 2003-03-04 05:50 PM
Re: Problem with kixtart and NT4.0
|
DJ Ballistic
Starting to like KiXtart
Registered: 2003-02-21
Posts: 185
|
Ok it ran successfully here is what I get:
ssexcounty,DC=net. Montgomery,OU=Users,OU=Information Systems,OU=AdminBldg,DC=su Error = 0 ErrorText = The operation completed successfully.
Why does it cut off the su on the first line? Is the first part of it on like 3 before the Error = 0 where it says DC=su?
But anyway that is what I get
|
Top
|
|
|
|
#73528 - 2003-03-04 05:56 PM
Re: Problem with kixtart and NT4.0
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
This does does not look correct. It appears that you have wrapping text.
I would also increase the size your your DOS window so your do not have the wrap issue and it will display on one line. [ 04. March 2003, 17:59: Message edited by: Howard Bullock ]
|
Top
|
|
|
|
#73529 - 2003-03-04 05:58 PM
Re: Problem with kixtart and NT4.0
|
DJ Ballistic
Starting to like KiXtart
Registered: 2003-02-21
Posts: 185
|
Ok now we are getting somewhere Yipee!!!!!
Here it is with that added
DN = CN=Matthew T. Montgomery,OU=Users,OU=Information Systems,OU=AdminBldg,DC=su ssexcounty,DC=net Error = 0 ErrorText = The operation completed successfully.
|
Top
|
|
|
|
#73530 - 2003-03-04 06:01 PM
Re: Problem with kixtart and NT4.0
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Your GetObject string should be: code:
"LDAP://OU=Users,OU=Information Systems,OU=AdminBldg,DC=sussexcounty,DC=net"
|
Top
|
|
|
|
#73531 - 2003-03-04 06:02 PM
Re: Problem with kixtart and NT4.0
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
Top
|
|
|
|
#73532 - 2003-03-04 06:05 PM
Re: Problem with kixtart and NT4.0
|
DJ Ballistic
Starting to like KiXtart
Registered: 2003-02-21
Posts: 185
|
OK that now works it says what my current logon script is and what it should be. It doesn't change anything because I haven't uncommented those lines to actually have it reset it.
That code on the top of page 2. That is what I ran and the results are stated above. What do I do with it?
|
Top
|
|
|
|
#73533 - 2003-03-04 06:12 PM
Re: Problem with kixtart and NT4.0
|
Howard Bullock
KiX Supporter
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
If it displayed all of the accounts you wish alter and you agree with the accounts listed, then remove the semi-colon in front of the two line that actually set the property. See below.code:
BREAK ON ; Example of LDAP call. GetObject("LDAP://ou=Users,ou=YourBusinessUnit,dc=YourCompany,dc=com") ; You need to know your LDAP connection. You can maybe find it by checking the propery details on the OU for your users. $target = GetObject("LDAP://your LDAP details") $loginscript="yourlogon.bat" for each $user in $target if $user.loginscript <> "$loginscript" ? "Current Script for " +$user.name " is: " +$user.loginscript+ " Should be: " +$loginscript $user.loginscript=$loginscript ; Remove the semi-colon at the front of this line to enable actually resetting the logon bat. $user.SetInfo ; Remove the semi-colon at the front of this line to enable actually resetting the logon bat. endif next
|
Top
|
|
|
|
#73534 - 2003-03-04 06:15 PM
Re: Problem with kixtart and NT4.0
|
DJ Ballistic
Starting to like KiXtart
Registered: 2003-02-21
Posts: 185
|
Well the user is named kixtest and is in the Test OU not the Users OU under Information Systems. I changed it accordingly below and I run the script but I don't get any errors, but I don't get any information like before either. It just says The task completed successfully.
Like this: "LDAP://OU=Test,OU=Information Systems,OU=AdminBldg,DC=sussexcounty,DC=net"
|
Top
|
|
|
|
#73535 - 2003-03-04 06:18 PM
Re: Problem with kixtart and NT4.0
|
DJ Ballistic
Starting to like KiXtart
Registered: 2003-02-21
Posts: 185
|
Ahh I see this code does. It checks to see if a login script is assigned to the user's profile itself. Well in that case I don't see how this will help me. I need to assign the logon scripts to the OU, I know you said I cannot do that with NT 4 but I am a little lost as to how this code is to help me.
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 447 anonymous users online.
|
|
|