Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for login_connect_network_drives.vbs

(view source code of login_connect_network_drives.vbs as plain text)

  1. Set wshNetwork = CreateObject( "WScript.Network" )
  2. On Error Resume Next
  3.  
  4. With wshNetwork
  5. 	.MapNetworkDrive "G:", "\\CompanyServer\Dept"
  6. 	If Err Then
  7. 		WScript.Echo "Error " & Err & " mapping drive G:"
  8. 		WScript.Echo "(" & Err.Description & ")"
  9. 	End If
  10.  
  11. 	.MapNetworkDrive "H:", "\\CompanyServer\" & .UserName
  12. 	If Err Then
  13. 		WScript.Echo "Error " & Err & " mapping drive H:"
  14. 		WScript.Echo "(" & Err.Description & ")"
  15. 	End If
  16. End With
  17.  
  18. On Error Goto 0
  19. Set wshNetwork = Nothing

page last uploaded: 2021-01-27, 16:12