Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
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.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Logon script check for servers

Reply
 
Old 08-15-2008   #1 (permalink)
Pasi Heino


 
 

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 SpecsSystem Spec
Old 08-15-2008   #2 (permalink)
Alex K. Angelopoulos


 
 

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 SpecsSystem Spec
Reply

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


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46