Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 703
  • Last Modified:

How to disable login script on specific computers?

Hi there,

We have recently created a vbscript file that automatically configures a user's Outlook signature.  We configured each user with a login script in AD, which in turn calls this vbscript file.  The signature is being created just fine with this script, but since this is part of a login script, the script will run every time the user logs in on their computer or on other computers.  It's fine if this script runs every time on the user's computer, but is there a way we can specify what computers this script shouldn't run on?  Specifically, we have a couple of meeting rooms and we don't want users to log on and have Outlook try to configure this signature, when it's not their personal computer.

Any suggestions?

- Christian
Christian Palacios
Christian Palacios
1 Solution
in script get the computer name and run if name == something

Set objNetwork = CreateObject("Wscript.Network")
If objNetwork.ComputerName = "Admin" Then
          Code here
          Code here
End If

Or other way, you can create another OU and run different gp on that
Christian PalaciosSenior IT Systems AdministratorAuthor Commented:
Thanks very much!  I'll give that a try and let you know.

We actually aren't using GP for this, we just set the login script on each user's AD account properties.

- Christian
Rather than having the script assigned to each user in AD why not have it run as a GPO that is assigned to the computers group but excluded from the meeting rooms Group
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Create a new AD group for the computers you don't want Outlook configured on.  Get the logon script to check if that computer is in that group.  If it is, then don't execute the Outlook config part of the script.
djsharmaTechnical ConsultantCommented:
You can use Group Policy to manage logon and startup scripts for Windows
2000/XP Pro/W2003 Computers. Logon scripts would be part of "user"
configuration and only apply to users within the scope of influence of the
Group Policy. You could create Organizational Units with Group Policies that
apply logon scripts to the users that have their user accounts in the OU.
Agreed with anyone who says to use a GPO for this.

A login script works for AD accounts that don't have exceptions--like a roaming profile or something similar. For this, since there are exceptions, you need to take it a step further than a standard script. Create a separate OU that does not have this policy applied and put the computer objects in there.
1 Click on "Start" button/option on the server running the group policies. Type "gpedit.msc" in the search text box and press "Enter." The Group Policy Editor loads on your server.

2 Double-click on the "User Configuration" policy in the left panel. Double-click Administrative Templates, the select  System,  Click Logon to view a list of Windows logon policies in the right detail panel.

3 Double-click on the policy named Run these programs at user logon. A configuration window opens. Click on the "Show" button/option to open a list of scripts running on the users' desktops.

4 Click the script you want to disable, then click the "Remove" option. The script is removed from the list. Click "OK" to save the settings and close the script editor.
Christian PalaciosSenior IT Systems AdministratorAuthor Commented:
Worked great!

Featured Post

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now