Page 1 of 1 1
Topic Options
#205263 - 2012-05-16 11:29 AM AD User Logon Script
FAISAL Offline
Just in Town

Registered: 2012-05-15
Posts: 2
Loc: Karachi, Pakistan
Hello,

I made a logon script for my AD users. I have 3 scripts named as:

1. logon.kix
2. sharedrive.kix
3. proxy.kix

 Code:
---------
logon.kix
---------

CLS
Small

Color b + /b
Box(2, 2, 5, 89, single)

Color b + /b
Box(5, 0, 28, 80, GRID)       ; 'background grid'

Color b + /b
Box(2, 0, 4, 79, single)
Color w + /b
At(3, 4) "DOIT                     Script Version @Kix                  $DT  "

Color b /n
Box(8, 21, 18, 41, Å)         ; 'shadow' of the box

Color w + /b
Box(7, 11, 21, 69, FULL)

Color w + /b
At(7, 30) " MBL "

Color w + /b
At(9, 19)  "Userid        :" 
At(10, 19) "Full name     :"
At(11, 19) "Description	 :"
At(12, 19) "Computer Name :"
At(13, 19) "IP Address    :"
At(14, 19) "MAC Address   :"
At(15, 19) "Domain        :"
At(16, 19) "Logon Domain  :"
At(17, 19) "Logon Server  :"

Color y + /b
At(9, 35)  @userid 
At(10, 35) @fullname
At(11, 35) $COMM
At(12, 35) @HostName
At(13, 35) $IPAddress
At(14, 35) @ADDRESS0
At(15, 35) @domain
At(16, 35) @LDomain
At(17, 35) $LS

Sleep 2

;Color c + /b
;Network Drives and Printers Mappings
?AT(19, 19) "Please wait while Network Resources are mapping"

Sleep 4

Call "sharedrive.kix"

--------------
sharedrive.kix
--------------
Color w + /b
At(19, 21)"Connecting Network Drives & Printers..."

If InGroup("ITD")
	Use O: /DEL
	Use O: "\\172.30.7.10\shared1$"
	Use S: "\\172.30.7.10\GShared"
	AddPrinterConnection("\\172.30.7.10\HPLaser1")
   SetDefaultPrinter("\\172.30.7.10\HPLaser1") = 0
EndIf

If InGroup("Finan")
	Use O: /DEL
	Use O: "\\172.30.7.10\shared2$"
	Use S: "\\172.30.7.10\GShared"
	AddPrinterConnection("\\172.30.7.10\Printer2")
   SetDefaultPrinter("\\172.30.7.10\Printer2") = 0
	EndIf

If InGroup("Mktg")
	Use O: /DEL
	Use O: "\\172.30.7.10\shared3$"
	Use S: "\\172.30.7.10\GShared"
	AddPrinterConnection("\\172.30.7.10\Printer3")
	SetDefaultPrinter("\\172.30.7.10\Printer3") = 0
   EndIf

Exit

---------
proxy.kix
---------

Color w + /b
At(19, 21)"Configure Internet Proxy Settings"

If InGroup("ITD")
	WriteValue("HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", 1, REG_DWORD)
	WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "172.23.1.2:8080", "REG_SZ") 
EndIf

If InGroup("MKTG")
	WriteValue("HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyEnable", 1, REG_DWORD)
	WriteValue("HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings", "ProxyServer", "10.1.2.164:8080", "REG_SZ") 
EndIf

Exit 1
Problem occured when display text written in scripts like first display

"Please wait while Network Resources are mapping"
then display
"Connecting Network Drives & Printers..."
then display
"Configure Internet Proxy Settings"


Edited by Glenn Barnas (2012-05-16 11:54 AM)
Edit Reason: added code tags

Top
#205264 - 2012-05-16 01:26 PM Re: AD User Logon Script [Re: FAISAL]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
Can you explain what issues you are experiencing? Are there any error messages on the screen, is part of the script not working, etc…?
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#205265 - 2012-05-16 01:53 PM Re: AD User Logon Script [Re: FAISAL]
FAISAL Offline
Just in Town

Registered: 2012-05-15
Posts: 2
Loc: Karachi, Pakistan
Thanks for immediate response.

Text is overlapping

First script shows a text like
"Please wait while Network Resources are mapping"

then is shows like
"Connecting Network Please wait while Network Resources are mapping"

Also i clear one thing, In past i use "ScriptLogic" for sharing and mapping purpose, but
my manager advised me to move from "ScriptLogic" to "Kixtart". so i made a script just like "ScriptLogic" but errors occured in text to display what script will be doing


Edited by FAISAL (2012-05-16 01:57 PM)

Top
#205266 - 2012-05-16 02:01 PM Re: AD User Logon Script [Re: FAISAL]
Mart Moderator Offline
KiX Supporter
*****

Registered: 2002-03-27
Posts: 4673
Loc: The Netherlands
This is normal. You write both lines on the same line in the console window so it overlaps. Using CLS in between would fix the overlapping but it will also remove all other stuff from the console window.

U Use several kixtart functions. They show a return value on the console window. If you use $rc = AddPrinterConnection(........ The returns code will be stored in $rc. If you do not display the contents of $rc you will not see the returns codes anymore.
_________________________
Mart

- Chuck Norris once sold ebay to ebay on ebay.

Top
#205267 - 2012-05-16 02:16 PM Re: AD User Logon Script [Re: Mart]
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
you use AT, so you clearly want to display the text on the same line.
if you want to clear the old text you can call AT twice:
 Code:
At(19, 21)"                                                               " ;clear the line
At(19, 21)"Configure Internet Proxy Settings"
_________________________
!

download KiXnet

Top
Page 1 of 1 1


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

Who's Online
0 registered and 793 anonymous users online.
Newest Members
M_Moore, BeeEm, min_seow, Audio, Hoschi
17883 Registered Users

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

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