+ Post New Thread
Page 2 of 2 FirstFirst 12
Results 16 to 18 of 18
Scripts Thread, Logon Script Help in Coding and Web Development; Originally Posted by apeo If you leave option explicit in then you need to define every variable before you use ...
  1. #16

    Join Date
    Oct 2007
    Location
    Cambridgeshire, UK
    Posts
    306
    Thank Post
    58
    Thanked 23 Times in 20 Posts
    Rep Power
    17
    Quote Originally Posted by apeo View Post
    If you leave option explicit in then you need to define every variable before you use it so if you run the script in its current format, yes it wont work. Also the 'on error resume next', well thats selfexplanatory.
    Turbo! I didn't fully understand what 'option explicit' did. Without that in (I'm sure I tried it before but hey...!) it worked. I also had to add another 'on error resume' to the removedrives sub routine to ensure that all existing drives were removed.

    Code:
    sub RemoveNetworkDrives
    
    	Dim NetDrives
    	Dim i
    
    	Set WSHNetwork = WScript.CreateObject("WScript.Network") 
    	Set NetDrives = WSHNetwork.EnumNetworkDrives
    	On Error Resume Next
    	If NetDrives.Count <> 0 Then
    		For i = 0 To NetDrives.Count - 1
    		WSHNetwork.RemoveNetworkDrive NetDrives(i)
    	Next	
    	End If
    
    end sub
    Thanks very much for all your help! I'll upload the complete script for future reference when I've tidied it up a bit.

    Dave.
    Last edited by djones; 13th March 2008 at 08:00 PM.

  2. #17
    apeo's Avatar
    Join Date
    Sep 2005
    Location
    Lost
    Posts
    1,612
    Thank Post
    95
    Thanked 115 Times in 111 Posts
    Rep Power
    41
    cool glad its working.

    I may just use your script for myself... now that you've done all the work

  3. #18

    Join Date
    Oct 2007
    Location
    Cambridgeshire, UK
    Posts
    306
    Thank Post
    58
    Thanked 23 Times in 20 Posts
    Rep Power
    17
    and :P

SHARE:
+ Post New Thread
Page 2 of 2 FirstFirst 12

Similar Threads

  1. Pro Set Pre-logon
    By mattx in forum Wireless Networks
    Replies: 11
    Last Post: 15th September 2008, 11:16 AM
  2. LogOn Message
    By karldenton in forum Windows
    Replies: 10
    Last Post: 28th January 2008, 06:17 PM
  3. Logon.bat query
    By speckytecky in forum Scripts
    Replies: 3
    Last Post: 20th April 2007, 10:08 AM
  4. Yet another Logon Script
    By ajbritton in forum Windows
    Replies: 3
    Last Post: 19th June 2006, 09:47 AM
  5. Ctrl+Alt+Del at logon
    By Michael in forum Windows
    Replies: 6
    Last Post: 30th March 2006, 02:33 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •