Link to home
Avatar of mrjking2000
mrjking2000

asked on

Server 2000 Logon Script question

I have a question for the group which I know is easily answered if you understand VBS scripts.  I found a script on EE here about a year ago that maps user drives and I found out how to add printers to the script as well...but each day the users log onto the machines they get two messages saying "user folders exists" and then " 'name' folder exists."

Here is the script,
====================================================
Dim objNetwork, objFSO
Dim strDriveLetter, strUNCPath, strUser

On Error Resume Next

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objNetwork= CreateObject("Wscript.Network")
strUser =objNetwork.UserName
strUNCPath = "\\harley\user folders"

if objFSO.FolderExists(strUNCPath) then
  WScript.Echo strUNCPath & " exists!"
  if objFSO.FolderExists(strUNCPath & "\" & strUser) then
    WScript.Echo strUNCPath & "\" & strUser & " exists!"
  else
    objFSO.CreateFolder(strUNCPath & "\" & strUser)
  end if
end if

strDriveLetter = "P:"
objNetwork.RemoveNetworkDrive strDriveLetter, True
objNetwork.MapNetworkDrive strDriveLetter,strUNCPath & "\" & strUser
WScript.Quit
===================================================

I know the messages are coming from this point below, but I have tried editing this and the script doesn't execute properly.

if objFSO.FolderExists(strUNCPath) then
  WScript.Echo strUNCPath & " exists!"
  if objFSO.FolderExists(strUNCPath & "\" & strUser) then
    WScript.Echo strUNCPath & "\" & strUser & " exists!"
  else
    objFSO.CreateFolder(strUNCPath & "\" & strUser)
  end if
end if


What do I need to do to make the messages stop popping up, the end users are finding this very annoying to click "ok" twice each morning.

Thanks!
--Justin
ASKER CERTIFIED SOLUTION
Avatar of ryangorman
ryangorman

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of mrjking2000
mrjking2000

ASKER

That did the trick, thanks ryangorman.

kinda like a dos script, rem voids out a line...now I know that ' voids out a VBS line.

Many Thanks!
--Justin