Welcome to the ScriptVault, where ScriptingAnswers.com users share their administrative scripts.

Have you written a script that accomplishes some administrative task? Please share it! Just navigate to the appropriate category and click the "Contribute to this category" link!

You are here: Top > Logon Scripts

Contribute to this category


Sub-Categories

(no categories are available)

 

Scripts

Check for Terminal Services II Contributed by John Graham
Here is another way to test for a RDP session or Citrix session and exit the logon script if detected. Note that SESSIONNAME environmental variable gets the appropriate value. TS: RDP-Tcp#nnn Citrix: ICA-tcp#nnn
Check for Terminal Services III (Easiest) Contributed by Aaron Castillo
This script simply checks the computer name of the computer running the script if strTScheck = Server Name then script will exit. I used ucase which means the Server Name in quotes must be in Upper Case.
Check for Terminal Services Contributed by Belaflek
I was told that the login scripts were not to run when people were loggin in via Term Serv so I wrote this up...seems to work ok
Check user for group membership Contributed by Don Jones
Note that this script uses the WinNT provider. It'll work with AD domains, but the AD-native LDAP provider doesn't provide the convenient IsMember method to perform this check.
Execute command based upon ip subnet Contributed by Rob Dunn
Gets the user's IP address, then runs a command based upon the subnet. Useful if you have remote servers with the same folder structures for enterprise-wide deployments, and you don't want anyone pulling the files over their slow connection. This one is set up to deploy E-Policy Orchestrator. Just change the variables below to fit your environment. You need to have a text file defined with a list of subnets that will be applied to this script (siteservers.txt). siteservers.txt file format must be like this: 1,x.x.x.,servername (Carriage Return) 0,x.x.x.,servername 1 = whether to deploy to that subnet or not (0 is off). x.x.x. = the first 3 octets of the subnet you wish to deploy to. servername = the server with the appropriate sharename (see strShare variable in the script) where the hotfixes reside. If you did have different folders on your remote servers, you could just append the paths directly to the server names in the siteservers.txt file and then replace the strShare path value with "" - this makes the variable blank. Just a thought. Benefits: Sites can be enabled/disabled just by changing the first placeholder value. You can be guaranteed that the file will not be pulled over a remote server if the user plugs into a WAN site.
Is logonserver in local site Contributed by Kirk Patten
In a distributed environment, when users move from site to site or network problems occur, the logonserver for a computer may not be in a local subnet. This can cause performance problems for the end user. This script can be used as a standalone tool or integrated into a logon script to check that the current logonserver is part of the current site defined for your subnet.
logon.vbs Contributed by Marcus L. Farmer
This script will populate the extensionAttribute15 with the computer name the user is logging onto as well as the date and time. This way, you can easily do a search in AD with another script and find the last computer, date, and time that a particular user logged on.
Map Drives Based on Group Membership I Contributed by Will F.
A vbs logon script to map drives according to group membership.
Map Drives Based on Group Membership Contributed by Don Jones
A perfect logon script component, this uses the WinNT provider's IsMember method (which works in AD domains, too) to check group membership and map drives accordingly.
Map drives by group Contributed by Belaflek
This will go in and get your AD domain account and use the IsMember to map by group...I tweaked this from the hey scripting guy archives at http://www.microsoft.com/technet/scriptcenter/resources/qanda/hsgarch.mspx You gotta be careful about what groups ur users are in tho
Map Printers via Machine Group Membership Contributed by Mark Goodwin
This script is a login script that we run daily to map printers by Machine instead of by user. It works on Windows XP Workstations and uses a combination of WMI and WSCRIPT.NETWORK to perform the tasks. It uses WMI to enumerate current printers on the machine and WSCRIPT.NETWORK to add printers and set the default.
OE Safe Attachments Contributed by Scott Klassen
In my environment, most users only have Outlook Express as the email client and we have a large number of attachments passing back and forth. That OE blocks all attachments by default, although a very good thing, has been a thorn in my side for quite a while. From the GUI, the setting is in Tools>Options>Security Tab>Do not allow attachments to be saved or opened that could potentially be a virus. This maps to a key in HKCU in the registry. Theoretically this script should change the setting for all email identities the current user may have.
remap drives to DFS Contributed by Michael Brierley
While this is a simple script it's fast and light. The share names need to be the same.