Randy
Tue Feb 22 14:52:33 CST 2005
Thank you Torgeir - that example is EXACTLY what I needed! Our servers
already exist, there is a naming convention (mostly), but I need to
guarantee that this command (or others like it in the future) do not run on
servers now or in the future.
Again, thanks!
Randy Reimers
"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:uvNs1HNGFHA.3492@TK2MSFTNGP12.phx.gbl...
> Randy Reimers wrote:
>
>> We have in our logon script a command to download updates from the main
>> server to the PC you are logging into. This works great except for when
>> we log into either a server, or to Citrix servers. I need to detect
>> whether the computer that you are logging into is NOT a server, then run
>> the script. We are using vbscript and mapping drives, functions through
>> "member of" and "case" statements. The output is sent through IE. Here
>> is the portion of the script that will need to be modified:
>>
>> Case UCase("cn=CCGG Jwalk
>> Users,OU=Common,OU=CC,DC=corp,DC=tcc,DC=inet")
>> strStatus = strStatus & vbCRLF & "Running JWalk Update"
>> ie.document.all.wstatus.InnerText = strStatus
>> WshShell.Run "W:\JWalk\jwalkjwc.bat", 1, true
>>
>> We need to detect if the computer that is getting logged into is a server
>> or not - this would need to work whether at the console, RDP, Citrix, or
>> other means. It needs to work for a normal user, as some Citrix users
>> also log in via a "normal" PC.
> Hi
>
> With VBScript:
>
> '--------------------8<----------------------
>
> If IsServer Then
> WScript.Echo "Server detected, quitting"
> WScript.Quit
> End If
>
>
> Function IsServer()
> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> ' Determines platform by reading reg val & comparing to known values
> '
http://support.microsoft.com/default.aspx?scid=kb;EN-US;152078
> '
> ' Returns True if server platform, False if not
> '
> ''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
> Dim oShell, sOStype, sOSversion
> Set oShell = CreateObject("Wscript.Shell")
>
> On Error Resume Next
> sOStype = oShell.RegRead(_
> "HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions\ProductType")
> If Err.Number <> 0 Then
> ' - Could not find this key, OS must be Win9x/ME
> Err.Clear
> IsServer = False
> Exit Function ' >>>
> End If
>
> Select Case sOStype
> Case "LanmanNT"
> IsServer = True
> Case "ServerNT"
> IsServer = True
> Case "WinNT"
> IsServer = False
> End Select
>
> End Function
> '--------------------8<----------------------
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
>
http://www.microsoft.com/technet/scriptcenter/default.mspx