Network_Padawan
asked on
Beginning to learn VB scripting...some help
I am just learning how to vbscript, I needed a script that maps and disconnects network drives for users that logon on the domain. I found the following scripts and they work, I just need help understanding the actual code...if anyone can please help me
To map a network drive
Set objNetwork = CreateObject("WScript.Netw ork") ...What is Wscript.Network??? Where does VBscript get this obeject from and what does it do?
Set objShell = CreateObject("WScript.Shel l")...Same as above...What is Wscript.Shell?
DriveLetter1 = "P:"
RemotePath1 = "\\alan\Drivers"
objNetwork.MapNetworkDrive DriveLetter1, RemotePath1
objShell.PopUp "Drive " & DriveLetter1 & " connected successfully."
Wscript.Quit
' End of example VBScript
To disconnect a network drive
Option Explicit .... What does this mean?
Dim objShell, objNetwork, DriveLetter1 ...What is dim?
DriveLetter1 = "P:"
Set objShell = CreateObject("WScript.Shel l")
Set objNetwork = CreateObject("WScript.Netw ork")
objNetwork.RemoveNetworkDr ive DriveLetter1
objShell.PopUp "Drive " & DriveLetter1 & " disconnected."
Wscript.Quit
' End of example VBScript
Thanks guys
To map a network drive
Set objNetwork = CreateObject("WScript.Netw
Set objShell = CreateObject("WScript.Shel
DriveLetter1 = "P:"
RemotePath1 = "\\alan\Drivers"
objNetwork.MapNetworkDrive
objShell.PopUp "Drive " & DriveLetter1 & " connected successfully."
Wscript.Quit
' End of example VBScript
To disconnect a network drive
Option Explicit .... What does this mean?
Dim objShell, objNetwork, DriveLetter1 ...What is dim?
DriveLetter1 = "P:"
Set objShell = CreateObject("WScript.Shel
Set objNetwork = CreateObject("WScript.Netw
objNetwork.RemoveNetworkDr
objShell.PopUp "Drive " & DriveLetter1 & " disconnected."
Wscript.Quit
' End of example VBScript
Thanks guys
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Awesome! Thanks
http://msdn.microsoft.com/
WScript.shell allows you to manipulate environment variables and the like see here :
http://msdn.microsoft.com/
Option Explicit means that all variables have to be declared see here :
http://msdn.microsoft.com/
DIM is used to dimension or declare variables see here :
http://msdn.microsoft.com/