logon scripts

  • Thread starter Thread starter Gino Angelozzi
  • Start date Start date
Hi Gino Angelozzi,

Creating logon scripts
===================
You can use a text editor to create logon scripts and then use the User
Properties page to assign different logon scripts to different users, or
assign the same logon script to multiple users, sites, domains, and
organizational units (OUs).

There are several special parameters you can use when creating logon
scripts.

Parameter Description

%HOMEDRIVE% The user's local workstation drive letter connected to the
user's home directory
%HOMEPATH% The full path of the user's home directory
%OS% The operating system of the user's workstation
%PROCESSOR_ARCHITECTURE% The processor type (such as 80386) of the user's
workstation
%PROCESSOR_LEVEL% The processor level of the user's workstation
%USERDOMAIN% The domain containing the user's account
%USERNAME% The user name

You can also create logon scripts in VBscript and JScript.

For more information look at
http://www.microsoft.com/windows2000/en/server/help/default.asp?url=/windows
2000/en/server/help/sag_lsconcepts_0.htm

Gino - Look at the following example on logon script
=============================================

The following example logon script contains VBScript commands that use
Active Directory Service Interfaces (ADSI) to perform three common tasks
based on a user's group membership:

It maps the H: drive to the home directory of the user by calling the WSH
Network object's MapNetworkDrive method in combination with the WSH Network
object's UserName property.
It uses the ADSI IADsADSystemInfo object to obtain the current user's
distinguished name, which in turn is used to connect to the corresponding
user object in Active Directory. Once the connection is established, the
list of groups the user is a member of is retrieved by using the user's
memberOf attribute. The multivalued list of group names is joined into a
single string by using VBScript's Join function to make it easier to search
for target group names.
If the current user is a member of one of the three groups defined at the
top of the script, then the script maps the user's G: drive to the group
shared drive, and sets the user's default printer to be the group printer.
To create an example logon script
Open Notepad.
Copy and paste, or type, the following:
Const ENGINEERING_GROUP = "cn=engineering"
Const FINANCE_GROUP = "cn=finance"
Const HUMAN_RESOURCES_GROUP = "cn=human resources"

Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:", "\\FileServer\Users\" & wshNetwork.UserName

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))

If InStr(strGroups, ENGINEERING_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\FileServer\Engineering\"
wshNetwork.AddWindowsPrinterConnection "\\PrintServer\EngLaser"
wshNetwork.AddWindowsPrinterConnection "\\PrintServer\Plotter"
wshNetWork.SetDefaultPrinter "\\PrintServer\EngLaser"

ElseIf InStr(strGroups, FINANCE_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\FileServer\Finance\"
wshNetwork.AddWindowsPrinterConnection "\\PrintServer\FinLaser"
wshNetWork.SetDefaultPrinter "\\PrintServer\FinLaser"

ElseIf InStr(strGroups, HUMAN_RESOURCES_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\FileServer\Human Resources\"
wshNetwork.AddWindowsPrinterConnection "\\PrintServer\HrLaser"
wshNetWork.SetDefaultPrinter "\\PrintServer\HrLaser"

End If
On the File menu, click Save As.
In Save in, click the directory that corresponds to the domain controller's
Netlogon shared folder (usually SystemRoot\SYSVOL\Sysvol\DomainName\Scripts
where DomainName is the domain's fully qualified domain name).
In Save as type, click All Files.
In File name, type a file name, followed by .vbs, and then click Save. WSH
uses the .vbs extension to identify files that contain VBScript commands.
Notes

To open Notepad, click Start, point to All Programs, point to Accessories,
and then click Notepad.
To use the example logon script, you need to change the group names,
network drive letters, and Universal Naming Convention (UNC) paths to match
your system environment.
To run a logon script, you need to assign the script to a user or a group.
For more information, see To assign a logon script to a user or group.

For more information look at
http://www.microsoft.com/resources/documentation/WindowsServ/2003/enterprise
/proddocs/en-us/Default.asp?url=/resources/documentation/WindowsServ/2003/en
terprise/proddocs/en-us/ctasks004.asp

Hope this information helps you.

Thanks,

(e-mail address removed)

This posting is provided "AS IS" with no warranties, and confers no rights.
 
thank you very much

gion angelozzi

S.J.Haribabu said:
Hi Gino Angelozzi,

Creating logon scripts
===================
You can use a text editor to create logon scripts and then use the User
Properties page to assign different logon scripts to different users, or
assign the same logon script to multiple users, sites, domains, and
organizational units (OUs).

There are several special parameters you can use when creating logon
scripts.

Parameter Description

%HOMEDRIVE% The user's local workstation drive letter connected to the
user's home directory
%HOMEPATH% The full path of the user's home directory
%OS% The operating system of the user's workstation
%PROCESSOR_ARCHITECTURE% The processor type (such as 80386) of the user's
workstation
%PROCESSOR_LEVEL% The processor level of the user's workstation
%USERDOMAIN% The domain containing the user's account
%USERNAME% The user name

You can also create logon scripts in VBscript and JScript.

For more information look at
http://www.microsoft.com/windows2000/en/server/help/default.asp?url=/windows
2000/en/server/help/sag_lsconcepts_0.htm

Gino - Look at the following example on logon script
=============================================

The following example logon script contains VBScript commands that use
Active Directory Service Interfaces (ADSI) to perform three common tasks
based on a user's group membership:

It maps the H: drive to the home directory of the user by calling the WSH
Network object's MapNetworkDrive method in combination with the WSH Network
object's UserName property.
It uses the ADSI IADsADSystemInfo object to obtain the current user's
distinguished name, which in turn is used to connect to the corresponding
user object in Active Directory. Once the connection is established, the
list of groups the user is a member of is retrieved by using the user's
memberOf attribute. The multivalued list of group names is joined into a
single string by using VBScript's Join function to make it easier to search
for target group names.
If the current user is a member of one of the three groups defined at the
top of the script, then the script maps the user's G: drive to the group
shared drive, and sets the user's default printer to be the group printer.
To create an example logon script
Open Notepad.
Copy and paste, or type, the following:
Const ENGINEERING_GROUP = "cn=engineering"
Const FINANCE_GROUP = "cn=finance"
Const HUMAN_RESOURCES_GROUP = "cn=human resources"

Set wshNetwork = CreateObject("WScript.Network")
wshNetwork.MapNetworkDrive "h:", "\\FileServer\Users\" & wshNetwork.UserName

Set ADSysInfo = CreateObject("ADSystemInfo")
Set CurrentUser = GetObject("LDAP://" & ADSysInfo.UserName)
strGroups = LCase(Join(CurrentUser.MemberOf))

If InStr(strGroups, ENGINEERING_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\FileServer\Engineering\"
wshNetwork.AddWindowsPrinterConnection "\\PrintServer\EngLaser"
wshNetwork.AddWindowsPrinterConnection "\\PrintServer\Plotter"
wshNetWork.SetDefaultPrinter "\\PrintServer\EngLaser"

ElseIf InStr(strGroups, FINANCE_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\FileServer\Finance\"
wshNetwork.AddWindowsPrinterConnection "\\PrintServer\FinLaser"
wshNetWork.SetDefaultPrinter "\\PrintServer\FinLaser"

ElseIf InStr(strGroups, HUMAN_RESOURCES_GROUP) Then

wshNetwork.MapNetworkDrive "g:", "\\FileServer\Human Resources\"
wshNetwork.AddWindowsPrinterConnection "\\PrintServer\HrLaser"
wshNetWork.SetDefaultPrinter "\\PrintServer\HrLaser"

End If
On the File menu, click Save As.
In Save in, click the directory that corresponds to the domain controller's
Netlogon shared folder (usually SystemRoot\SYSVOL\Sysvol\DomainName\Scripts
where DomainName is the domain's fully qualified domain name).
In Save as type, click All Files.
In File name, type a file name, followed by .vbs, and then click Save. WSH
uses the .vbs extension to identify files that contain VBScript commands.
Notes

To open Notepad, click Start, point to All Programs, point to Accessories,
and then click Notepad.
To use the example logon script, you need to change the group names,
network drive letters, and Universal Naming Convention (UNC) paths to match
your system environment.
To run a logon script, you need to assign the script to a user or a group.
For more information, see To assign a logon script to a user or group.

For more information look at
http://www.microsoft.com/resources/documentation/WindowsServ/2003/enterprise
/proddocs/en-us/Default.asp?url=/resources/documentation/WindowsServ/2003/en
terprise/proddocs/en-us/ctasks004.asp

Hope this information helps you.

Thanks,

(e-mail address removed)

This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top