Help Changing Logon Script Info 
Author Message
 Help Changing Logon Script Info

Hello,

Recently I tried to use a modified script to blank out the login
scripts for certain users.  For some reason the script never worked
properly.  The weird thing is that I had a previous script which did
the job, but it got deleted.  Could someone please take a look and
tell me what is wrong with it?

****************************************************************************************************
' Assign Variables

Dim DomainString, fso, DomainObj, lscript, UserObj

' Create Object for File System Access

set fso = CreateObject ("Scripting.FileSystemObject")

' Set Domain Name
DomainString = "OKLAHOMA_COUNTY" 'Modify this line or this script wont
work

' Open ADSI and connect to Domain user data

Set DomainObj = GetObject("WinNT://" & DomainString)
DomainObj.Filter = Array("user")

' List all users

For Each UserObj In DomainObj
   lscript = UserObj.LoginScript
   If lscript = "VBScript" then lscript = ""

Next ' Repeat for all users

Wscript.Quit
*****************************************************************************************************

--
Anthony Boynes
anthony-at-oklahomacounty-dot-org



Sun, 18 May 2003 03:00:00 GMT  
 Help Changing Logon Script Info

In your script you never reset the property. Try something like this....

set oDomain = GetObject("WinNT://domain")
oDomain.Filter = Array("user")

Set RegExpression = New RegExp  
RegExpression.Pattern = "logon.vbs"  
RegExpression.IgnoreCase = True

For Each oUser in oDomain
 If RegExpression.Test(oUser.LoginScript) Then
  oUser.Put "LoginScript", "newlogon.vbs"
  oUser.SetInfo
 End If
Next

msgbox "All Done"

Clarence

Win32Scripting....
No, not that other one..... THE ORIGINAL...
http://cwashington.netreach.net

On THIS site you will find everything you need to get up and running. A
script repository with almost 400 FREE sample scripts, a downloads section
with FREE COM objects for scripting, a library of reference materials and an
online discussion lounge to provide community based technical support. Check
it out.

Quote:

> Hello,

> Recently I tried to use a modified script to blank out the login
> scripts for certain users.  For some reason the script never worked
> properly.  The weird thing is that I had a previous script which did
> the job, but it got deleted.  Could someone please take a look and
> tell me what is wrong with it?

> ****************************************************************************************************
> ' Assign Variables

> Dim DomainString, fso, DomainObj, lscript, UserObj

> ' Create Object for File System Access

> set fso = CreateObject ("Scripting.FileSystemObject")

> ' Set Domain Name
> DomainString = "OKLAHOMA_COUNTY" 'Modify this line or this script wont
> work

> ' Open ADSI and connect to Domain user data

> Set DomainObj = GetObject("WinNT://" & DomainString)
> DomainObj.Filter = Array("user")

> ' List all users

> For Each UserObj In DomainObj
>    lscript = UserObj.LoginScript
>    If lscript = "vbscript" then lscript = ""

> Next ' Repeat for all users

> Wscript.Quit
> *****************************************************************************************************

> --
> Anthony Boynes
> anthony-at-oklahomacounty-dot-org



Sun, 18 May 2003 03:00:00 GMT  
 Help Changing Logon Script Info

Thanks!

On Wed, 29 Nov 2000 07:31:13 -0600, "Clarence Washington Jr."

Quote:

>In your script you never reset the property. Try something like this....

>set oDomain = GetObject("WinNT://domain")
>oDomain.Filter = Array("user")

>Set RegExpression = New RegExp  
>RegExpression.Pattern = "logon.vbs"  
>RegExpression.IgnoreCase = True

>For Each oUser in oDomain
> If RegExpression.Test(oUser.LoginScript) Then
>  oUser.Put "LoginScript", "newlogon.vbs"
>  oUser.SetInfo
> End If
>Next

>msgbox "All Done"

>Clarence

>Win32Scripting....
>No, not that other one..... THE ORIGINAL...
>http://cwashington.netreach.net

>On THIS site you will find everything you need to get up and running. A
>script repository with almost 400 FREE sample scripts, a downloads section
>with FREE COM objects for scripting, a library of reference materials and an
>online discussion lounge to provide community based technical support. Check
>it out.


>> Hello,

>> Recently I tried to use a modified script to blank out the login
>> scripts for certain users.  For some reason the script never worked
>> properly.  The weird thing is that I had a previous script which did
>> the job, but it got deleted.  Could someone please take a look and
>> tell me what is wrong with it?

>> ****************************************************************************************************
>> ' Assign Variables

>> Dim DomainString, fso, DomainObj, lscript, UserObj

>> ' Create Object for File System Access

>> set fso = CreateObject ("Scripting.FileSystemObject")

>> ' Set Domain Name
>> DomainString = "OKLAHOMA_COUNTY" 'Modify this line or this script wont
>> work

>> ' Open ADSI and connect to Domain user data

>> Set DomainObj = GetObject("WinNT://" & DomainString)
>> DomainObj.Filter = Array("user")

>> ' List all users

>> For Each UserObj In DomainObj
>>    lscript = UserObj.LoginScript
>>    If lscript = "vbscript" then lscript = ""

>> Next ' Repeat for all users

>> Wscript.Quit
>> *****************************************************************************************************

>> --
>> Anthony Boynes
>> anthony-at-oklahomacounty-dot-org

--
Anthony Boynes
anthony-at-oklahomacounty-dot-org


Sun, 18 May 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Help with logon script to change screen resolutions

2. Help with simple logon script to change screen resolution

3. logon.exe script.vbs in profile (logon script)

4. logon script - making changes to the registry

5. change Permissions on logon-script

6. Logon Script to change password

7. How can I get logon server name and IP address from logon script using wsh

8. Win98, Logon script & finding logon server

9. Help Required with VB Logon Script

10. Need help with logon script

11. WSH in W2Kpro - help about logon script

12. Logon script help!!

 

 
Powered by phpBB® Forum Software