![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Logon script check for servers I have logon script (vbs) and I don't want to run script in servers. I have citrix and ms ts servers, where users don't need logon scripts or it would be better that scripts are not executed when loggin to server. |
My System Specs![]() |
| | #2 (permalink) |
| | Re: Logon script check for servers Try the following code snippet at the beginning of the logon script. This connects to the local system's WMI subsystem and checks the DomainRole property of Win32_ComputerSystem. Anything but 0 or 1 is a server. The code exits the script if it encounters one of these higher values. The code snippet: Dim instances, instance, cs Set instances = GetObject("winmgmts://./root/cimv2")._ InstancesOf("Win32_ComputerSystem") For each instance in instances Set cs = instance next If cs.DomainRole > 1 Then WScript.Quit End If Here are the implemented values for DomainRole and what they mean: Value Meaning 0 Standalone Workstation 1 Member Workstation 2 Standalone Server 3 Member Server 4 Backup Domain Controller 5 Primary Domain Controller "Pasi Heino" <pasi.heino@xxxxxx> wrote in message news:ejdGjks$IHA.2060@xxxxxx Quote: > I have logon script (vbs) and I don't want to run script in servers. I > have citrix and ms ts servers, where users don't need logon scripts or it > would be better that scripts are not executed when loggin to server. > > |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| Check if service is running on several servers | VB Script | |||
| Logon Script Causing Laptops To Hang - Problems in script? | VB Script | |||
| script to change SNMP Community name on 150 servers | VB Script | |||
| script to run daily to monitor servers' statuses | VB Script | |||
| Script that goes out over the network to all servers | VB Script | |||