Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Make network connection from scheduled task
Message
De
05/11/2004 17:48:04
Gaylen Miller
Leaderware Corporation
Fulton, Illinois, États-Unis
 
 
À
05/11/2004 17:29:45
Guy Pardoe
Pardoe Development Corporation
Peterborough, New Hampshire, États-Unis
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00958713
Message ID:
00958718
Vues:
20
Guy,

You can create .vbs files that will map and unmap drives on the fly.
These Windows script files can be called by Scheduler or VFP.
Of course your admin username and password must successfully authenticate in any server you are mapping.

This code will map 5 drives:
On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")

objNetwork.MapNetworkDrive "I:", "\\Aseserver\I", True
objNetwork.MapNetworkDrive "J:", "\\Aseserver\J", True
objNetwork.MapNetworkDrive "K:", "\\Aseserver\k", True
objNetwork.MapNetworkDrive "H:", "\\Aseserver\k", True
objNetwork.MapNetworkDrive "S:", "\\Shopserver\Data (D)", True
This code will unmap all drives:
On Error Resume Next
Set objNetwork = CreateObject("WScript.Network")

Set colDrives = objNetwork.EnumNetworkDrives
i = 0
For i = 0 to colDrives.Count-1 Step 2
   strDrive = colDrives.Item(i)
   objNetwork.RemoveNetworkDrive strDrive, True, True
Next
Thanks
Gaylen Miller
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform