Problem in running .vbs as loginscript 
Author Message
 Problem in running .vbs as loginscript

 Need help w/ VBScript here are some problem I'm having difficulty with:

a) How do you run a .vbs file as a login script. I installed the wsh on
the NT workstation,
    copied the .vbs file in the winnt\system32\repl\import\script of my
BDC, and modify my
    user profile to include the .vbs script I created. When I try to
login its not running the .vbs
    file.

b) How can I check if a user belongs to a particular group? I tried the
following but I think
    I'm missing something:

    Dim usrName
    Dim objGroup
    Dim WshUsrEnv

    Set WshUsrEnv = WshShell.Environment("User")
    Set usrName = WshUsrEnv("USERNAME")
    Set objGroup = GetObject("WinNT://Domain/group")
    if objGroup.IsMember("WinNT://Domain/" & usrName) Then

    Else ......
    end if

c) Last problem I'm having: Is there a way of getting the network subnet
via VBscript?? I found some code in getting the IP address, but how do
you truncate the string? I'm only interested on the subnet (Ex. IP =
192.168.84.92 the number I'm interested in is 84) I want to compare
different subnet, so the script will run just on a particular subnet

Please Help...thanks

joey



Mon, 14 May 2001 03:00:00 GMT  
 Problem in running .vbs as loginscript
Hi, the first problem is that you can only run a .bat, .cmd or .exe file
from the logon script defined in a user profile. So just create a bat file
in the netlogon directory with the following line...

wscript \\Server\netlogon\logon.wsh

(you can create the WSH file by right clicking the .vbs file, selecting
properties then OK)
For the group thing to work you must have ADSI installed on each
workstation.
See http://www.microsoft.com/ntserver/windowsnt5/exec/feature/ADSIintro.asp

To get the 3rd octet of the IP address use the Split function. This will
create an array of values.
Split(expression[, delimiter[, count[, compare]]])
ie...
 sSubNet = Split(sIPAddr,".")
if sSubNet(3) = "84" then
...
End If

Regards,
Ian
WSH FAQ http://wsh.glazier.co.nz/frame.htm

Quote:

> Need help w/ VBscript here are some problem I'm having difficulty with:

>a) How do you run a .vbs file as a login script. I installed the wsh on
>the NT workstation,
>    copied the .vbs file in the winnt\system32\repl\import\script of my
>BDC, and modify my
>    user profile to include the .vbs script I created. When I try to
>login its not running the .vbs
>    file.

>b) How can I check if a user belongs to a particular group? I tried the
>following but I think
>    I'm missing something:

>    Dim usrName
>    Dim objGroup
>    Dim WshUsrEnv

>    Set WshUsrEnv = WshShell.Environment("User")
>    Set usrName = WshUsrEnv("USERNAME")
>    Set objGroup = GetObject("WinNT://Domain/group")
>    if objGroup.IsMember("WinNT://Domain/" & usrName) Then

>    Else ......
>    end if

>c) Last problem I'm having: Is there a way of getting the network subnet
>via VBscript?? I found some code in getting the IP address, but how do
>you truncate the string? I'm only interested on the subnet (Ex. IP =
>192.168.84.92 the number I'm interested in is 84) I want to compare
>different subnet, so the script will run just on a particular subnet

>Please Help...thanks

>joey



Tue, 15 May 2001 03:00:00 GMT  
 Problem in running .vbs as loginscript
Thanks a lot for the help.  I appreciate it.

With regard to your suggestion about the group, is there another way to find
out
where a user belongs to which group in NT using VBScript without installing
ADSI?
I don't know anything about ADSI and I just want to avoid using it for now.
This is
an immediate requirement and I need to finish it ASAP.  I would look into ADSI
later on.

Please advise.

Thanks,

Joey

Quote:

> Hi, the first problem is that you can only run a .bat, .cmd or .exe file
> from the logon script defined in a user profile. So just create a bat file
> in the netlogon directory with the following line...

> wscript \\Server\netlogon\logon.wsh

> (you can create the WSH file by right clicking the .vbs file, selecting
> properties then OK)
> For the group thing to work you must have ADSI installed on each
> workstation.
> See http://www.microsoft.com/ntserver/windowsnt5/exec/feature/ADSIintro.asp

> To get the 3rd octet of the IP address use the Split function. This will
> create an array of values.
> Split(expression[, delimiter[, count[, compare]]])
> ie...
>  sSubNet = Split(sIPAddr,".")
> if sSubNet(3) = "84" then
> ...
> End If

> Regards,
> Ian
> WSH FAQ http://wsh.glazier.co.nz/frame.htm


> > Need help w/ VBscript here are some problem I'm having difficulty with:

> >a) How do you run a .vbs file as a login script. I installed the wsh on
> >the NT workstation,
> >    copied the .vbs file in the winnt\system32\repl\import\script of my
> >BDC, and modify my
> >    user profile to include the .vbs script I created. When I try to
> >login its not running the .vbs
> >    file.

> >b) How can I check if a user belongs to a particular group? I tried the
> >following but I think
> >    I'm missing something:

> >    Dim usrName
> >    Dim objGroup
> >    Dim WshUsrEnv

> >    Set WshUsrEnv = WshShell.Environment("User")
> >    Set usrName = WshUsrEnv("USERNAME")
> >    Set objGroup = GetObject("WinNT://Domain/group")
> >    if objGroup.IsMember("WinNT://Domain/" & usrName) Then

> >    Else ......
> >    end if

> >c) Last problem I'm having: Is there a way of getting the network subnet
> >via VBscript?? I found some code in getting the IP address, but how do
> >you truncate the string? I'm only interested on the subnet (Ex. IP =
> >192.168.84.92 the number I'm interested in is 84) I want to compare
> >different subnet, so the script will run just on a particular subnet

> >Please Help...thanks

> >joey



Tue, 15 May 2001 03:00:00 GMT  
 Problem in running .vbs as loginscript

There is an executable on my site that will allow you to run Vbscripts WITHOUT invoking it from a batch file. You can find it in the downloads section.

Clarence
Check it out
http://cwashington.netreach.net

Win32 bit scripting. Everything you need to get up and running,
A script repository containing almost 100 sample scripts,
downloads, reference files, and technical support via an
online discussion forum.

(Pursuant to US Code, Title 47, Chapter 5, Subchapter II, 227, any and all
unsolicited commercial E-mail sent to this address is subject to a download
and archival fee in the amount of $1000 US.  E-mailing denotes acceptance of
these terms.)

Need help w/ VBscript here are some problem I'm having difficulty with:

a) How do you run a .vbs file as a login script. I installed the wsh on
the NT workstation,
    copied the .vbs file in the winnt\system32\repl\import\script of my
BDC, and modify my
    user profile to include the .vbs script I created. When I try to
login its not running the .vbs
    file.

b) How can I check if a user belongs to a particular group? I tried the
following but I think
    I'm missing something:

    Dim usrName
    Dim objGroup
    Dim WshUsrEnv

    Set WshUsrEnv = WshShell.Environment("User")
    Set usrName = WshUsrEnv("USERNAME")
    Set objGroup = GetObject("WinNT://Domain/group")
    if objGroup.IsMember("WinNT://Domain/" & usrName) Then

    Else ......
    end if

c) Last problem I'm having: Is there a way of getting the network subnet
via VBscript?? I found some code in getting the IP address, but how do
you truncate the string? I'm only interested on the subnet (Ex. IP =
192.168.84.92 the number I'm interested in is 84) I want to compare
different subnet, so the script will run just on a particular subnet

Please Help...thanks

joey



Fri, 18 May 2001 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. VBS-Loginscript an Win95

2. using a .vbs for loginscript

3. Problem with Loginscript and drive mapping.

4. Problem running ADSUTIL.VBS

5. Problem running VBS from script shell

6. Having problem running a pgm from inside vbs

7. Problem with run method and vbs

8. Calling *.vbs files to Run From Master VBS File

9. Running a .vbs script from within a .vbs script

10. Run in Interdev, Problems when running standalone

11. VB LoginScript

12. VB script as Loginscript

 

 
Powered by phpBB® Forum Software