Page 1 of 1 1
Topic Options
#162080 - 2006-05-19 04:04 PM Matching Hostname
Ste Offline
Fresh Scripter

Registered: 2003-05-28
Posts: 10
Hi

I need to be able to check the hostname of the machine that the user is on and either match this to a text file or match keyword (such as SQL, IIS, PRINT) etc so that if there is a match I can log the user out

The reason behind this is that I don't want to run our logon scripts if the user is logging onto one of our servers

Thanks in advance

Top
#162081 - 2006-05-19 04:16 PM Re: Matching Hostname
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
@WkSta
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#162082 - 2006-05-22 05:44 PM Re: Matching Hostname
Ste Offline
Fresh Scripter

Registered: 2003-05-28
Posts: 10
Thanks Les

I know to use @WkSta but I am not sure what code is required to enable me to match any part of the host to keywords like "SQL, IIS, CRYSTAL" etc?

Top
#162083 - 2006-05-22 06:32 PM Re: Matching Hostname
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
Use the INSTR command (Page 79)
_________________________
Today is the tomorrow you worried about yesterday.

Top
#162084 - 2006-05-22 07:12 PM Re: Matching Hostname
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Instead of matching on a partial name, why not just test for server?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#162085 - 2006-05-22 07:22 PM Re: Matching Hostname
Gargoyle Offline
MM club member
*****

Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
another ? would be why are users logging into servers?
_________________________
Today is the tomorrow you worried about yesterday.

Top
#162086 - 2006-05-24 09:21 AM Re: Matching Hostname
Ste Offline
Fresh Scripter

Registered: 2003-05-28
Posts: 10
Hi

Thanks for your answers so far:

Gargoyle.....At present our domain admins need to be able to run logon scripts. The reason being is they use this account for their day to day activities. I know this isn't best practice (as I am from a security background) but the file permissions etc in the company will break if I change this.

My current requirement is to check if the domain admin is logging onto a server (as opposed to their workstation) and if so quit. To answer Les....we have that many servers that it would be impossible to list them all, unless I could specify this in a text file and someone could tell me how to read this in and check for it?

Thanks Guys

Top
#162087 - 2006-05-24 01:45 PM Re: Matching Hostname
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Is there any reason you can't check just for a server OS? Something like

Code:

if instr(@ProductType,'Server') or instr(@ProductType,'Domain')
? 'This is a server'
endif



Quote:


@ProductType OS type. Possible values:
"Windows 95"
"Windows 98"
"Windows Me"
"Windows NT Workstation"
"Windows NT Server"
"Windows NT Domain Controller"
"Windows 2000 Professional"
"Windows 2000 Server"
"Windows 2000 Domain Controller"
"Windows XP Home Edition"
"Windows XP Home Edition Tablet PC"
"Windows XP Professional"
"Windows XP Professional Tablet PC"
"Windows Server 2003"
"Windows Server 2003 Domain Controller"




Top
#162088 - 2006-05-25 12:21 AM Re: Matching Hostname
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
This will quit the logon script for ANY type of Microsoft Server
 

Code:
Dim $IsServer
$IsServer = ReadValue('HKLM\SYSTEM\CurrentControlSet\Control\ProductOptions', 'ProductType')
If $IsServer<>'WinNT'
Quit 10
EndIf


Top
#162089 - 2006-05-25 12:29 AM Re: Matching Hostname
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Ja well... all of the above are equal opportunity discriminators of Terminal servers.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#162090 - 2006-05-25 01:31 AM Re: Matching Hostname
NTDOC Administrator Offline
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
and that's a bad thing

Think he should get the idea by now though on multiple ways to determine what it is he's wanting to do.

Normally I wouldn't bail out on the script just because it was a server any ways. I might branch out and do something else though.

One could even read a .INI of systems to not run on, or create an array within the script.

Plenty of ways to skin a cat so to speak.

Top
#162091 - 2006-05-25 01:37 AM Re: Matching Hostname
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Quote:

Plenty of ways to skin a cat



Now, now... no need to get the SPCA or PETA involved. We know how much of a PITA they can be.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 2220 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.07 seconds in which 0.033 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org