Logon script

  • Follow


Making a logon script for two locations and want the script to understand 
what location is logged on to.
I can determen this with %logonserver% but is there any properties in vb 
script that gives me the same function?

Or any other suggestions.

-T 


0
Reply Terry 11/22/2009 10:42:59 PM

"Terry" <terje@itl.no> wrote in message 
news:%23mVurU8aKHA.4688@TK2MSFTNGP06.phx.gbl...
> Making a logon script for two locations and want the script to understand 
> what location is logged on to.
> I can determen this with %logonserver% but is there any properties in vb 
> script that gives me the same function?
>
> Or any other suggestions.
>
> -T

Check out script56.chm for the function "ExpandEnvironmentStrings" of the 
WshShell object. There is an example there too. 


0
Reply Pegasus 11/22/2009 10:57:21 PM


"Pegasus [MVP]" <news@microsoft.com> wrote in message 
news:#h5onc8aKHA.1596@TK2MSFTNGP06.phx.gbl...
>
> "Terry" <terje@itl.no> wrote in message 
> news:%23mVurU8aKHA.4688@TK2MSFTNGP06.phx.gbl...
>> Making a logon script for two locations and want the script to understand 
>> what location is logged on to.
>> I can determen this with %logonserver% but is there any properties in vb 
>> script that gives me the same function?
>>
>> Or any other suggestions.
>>
>> -T
>
> Check out script56.chm for the function "ExpandEnvironmentStrings" of the 
> WshShell object. There is an example there too.

I don't know of any environment variables that would contain hints about the 
logical location of a workstation. While useful, Logonserver is not fool 
proof. We have one DC at our location. If we take it offline for service, 
our users will authenticate against potentially distant DC's.

Another approach would be to use the ADSystemInfo to determine the Active 
Directory site, I extracted the short script that follows from the end of 
this page: http://www.fpschultze.de/?tag=active-directory

01.On Error Resume Next
02.
03.Set objSysInfo = WScript.CreateObject("ADSystemInfo")
04.Set objNetwork = WScript.CreateObject("Wscript.Network")
05.
06.strSiteName = objSysInfo.SiteName
07.
08.Select Case strSiteName
09.   Case "Amsterdam"
10.      objNetwork.MapNetworkDrive "X:", "\\fs-nl\data"
11.   Case "Berlin"
12.      objNetwork.MapNetworkDrive "X:", "\\fs-de\data"
13.   Case "London"
14.      objNetwork.MapNetworkDrive "X:", "\\fd-gb\data"
15.   Case "Paris"
16.      objNetwork.MapNetworkDrive "X:", "\\fs-fr\data"
17.End Select

Of course, this assumes that the AD site is sufficient for your purposes.

/Al
 

0
Reply Al 11/23/2009 3:16:37 AM

2 Replies
244 Views

(page loaded in 0.057 seconds)

Similiar Articles:
















7/14/2012 3:40:03 AM


Reply: