Esempio vbs netlogon


Option Explicit
Dim objNetwork
Dim WshNetwork
Dim objFSO
Dim strUNCPrinter1

Set objNetwork = CreateObject(“WScript.Network”)
Set WshNetwork = CreateObject(“WScript.Network”)

Set objFSO = CreateObject(“Scripting.FileSystemObject”)
Set WshNetwork = WScript.CreateObject(“WScript.Network”)

ON ERROR RESUME NEXT

If Not objFSO.DriveExists (“H:”) Then
WshNetwork.MapNetworkDrive “H:”, “\Server” & WshNetwork.UserName
End If
If Not objFSO.DriveExists (“T:”) Then
WshNetwork.MapNetworkDrive “T:”,”\ServerTransito”
End If

strUNCPrinter1 = “\PrinterCommerciali”
objNetwork.AddWindowsPrinterConnection strUNCPrinter1
objNetwork.SetDefaultPrinter strUNCPrinter1
Wscript.Quit