Joesmail
asked on
using IWshRuntimeLibrary in C#
Hi Experts,
I would like to know how to use the using WshNetworkClass.....to safely Add Printers and Map a Network Drive.
I have managed to Add a printer passing it "" values for driver & port, although when I try to MapNetworkDrive I don't know what I should be supplying the ref objects?
Can anyone help me with this please...
Thanks in advance.
I would like to know how to use the using WshNetworkClass.....to safely Add Printers and Map a Network Drive.
I have managed to Add a printer passing it "" values for driver & port, although when I try to MapNetworkDrive I don't know what I should be supplying the ref objects?
Can anyone help me with this please...
Thanks in advance.
ASKER
To be clearer....I am trying to map a drive using the following library....
using IWshRuntimeLibrary;
...
...
WshNetworkClass network = new WshNetworkClass();
...
...
network.MapNetworkDrive(_d rive, @"\\" + _server + @"\" + _share,REF OBJECT, REF OBJECT, REF OBJECT);
Can anyone give me some examples of the REFs required here........
using IWshRuntimeLibrary;
...
...
WshNetworkClass network = new WshNetworkClass();
...
...
network.MapNetworkDrive(_d
Can anyone give me some examples of the REFs required here........
i guess this works in VBScript. It should successfully map to a network drive
\\server1\data.
Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScr ipt.Networ k")
sPwd = inputbox("Enter password")
WshNetwork.MapNetworkDrive "J:", "\\server1\data", false,
"xyz_net\John", sPwd
Msgbox "Drives has been mapped successfully"
\\server1\data.
Dim WshNetwork
Set WshNetwork = WScript.CreateObject("WScr
sPwd = inputbox("Enter password")
WshNetwork.MapNetworkDrive
"xyz_net\John", sPwd
Msgbox "Drives has been mapped successfully"
ASKER
you guessed wrong.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks for this gregoryyoung
Just one last question. Do you know if there is a way around having to PASS the password. I can identify the username easily enought Environment.Username although I don't know how I would pass the "password" credentials through?
Just one last question. Do you know if there is a way around having to PASS the password. I can identify the username easily enought Environment.Username although I don't know how I would pass the "password" credentials through?
I would imagine that is if you want to use a different username/pass (without knowing the library). My guess would be that passing null attempts to use your current token (but this is just a guess)
https://www.experts-exchange.com/questions/21685680/Hanging-on-line-Microsoft-VisualBasic-Interaction-CallByName.html