multiple mapped drives & user properties 
Author Message
 multiple mapped drives & user properties

Guys, I am very close to getting a ground up script running with your help.
I have a algorithm question regarding using a popup box and displaying drive
mappings. Considering the group recommendation of using a popup property of
wscript.Shell object how do I display varying number of drives that I map
per group and user properties (username/domain/Computername ) in a popup
box?
thanks
Malik


Tue, 05 Feb 2002 03:00:00 GMT  
 multiple mapped drives & user properties
Simply build up a concatenated string with vbCrLf between each piece and
show it with Popup.

--
Michael Harris


| Guys, I am very close to getting a ground up script running with your
help.
| I have a algorithm question regarding using a popup box and displaying
drive
| mappings. Considering the group recommendation of using a popup property
of
| wscript.Shell object how do I display varying number of drives that I map
| per group and user properties (username/domain/Computername ) in a popup
| box?
| thanks
| Malik
|
|
|



Tue, 05 Feb 2002 03:00:00 GMT  
 multiple mapped drives & user properties
thanx man.. you are quick at responses.. Appreciate the response


Quote:
> Simply build up a concatenated string with vbCrLf between each piece and
> show it with Popup.

> --
> Michael Harris



> | Guys, I am very close to getting a ground up script running with your
> help.
> | I have a algorithm question regarding using a popup box and displaying
> drive
> | mappings. Considering the group recommendation of using a popup property
> of
> | wscript.Shell object how do I display varying number of drives that I
map
> | per group and user properties (username/domain/Computername ) in a popup
> | box?
> | thanks
> | Malik
> |
> |
> |



Tue, 05 Feb 2002 03:00:00 GMT  
 multiple mapped drives & user properties
One of my efforts using/altering examples I have collected:
Note: the EnumPrinters collection oesnt work so dont try and sisplay the
mapped printers on the network.
_________________________________

Dim WSHNetwork, shell
Dim colDrives, colPrinters, SharePoint
Dim CRLF
Dim strDrives(5,2)
Dim strPrinters(2,2), intPrinter

strPrinters(1,1)="\\server\4mv"
strPrinters(1,2)="HP Laserjet 4mv"

strPrinters(2,1)="\\server\lj5"
strPrinters(2,2)="Laserjet 5"

strDrives(1,1)="F:"
strDrives(1,2)="CAD"

strDrives(2,1)="H:"
strDrives(2,2)="USERS"

strDrives(3,1)="I:"
strDrives(3,2)="OFFICE"

strDrives(4,1)="J:"
strDrives(4,2)="DATA"

CRLF = Chr(13) & Chr(10)
Set WSHNetwork = WScript.CreateObject("WScript.Network")

'Enumerate network drives and Printers into a collection object of type
WshCollection
Set colDrives = WSHNetwork.EnumNetworkDrives
set colPrinters = WSHNetwork.EnumPrinterConnections

Function TryMapPrinter(printer, driver)
   on error resume next
   WSHNetwork.addwindowsprinterconnection printer,driver
   TryMapPrinter=Err.Number=0
end Function

Function TryMapDrive(strDrive, strShare)
    On Error Resume Next
    WSHNetwork.MapNetworkDrive strDrive, strShare
    TryMapDrive = Err.Number = 0
End Function

    For intPrinter = 1 To 2 Step 1
        If TryMapPrinter(strPrinters(intPrinter,1),
strPrinters(intPrinter,2)) Then Exit For
    Next

    For intDrive = 1 To 5 Step 1
        If TryMapDrive(strdrives(intDrive,1), strDrives(intDrive,2)) Then
Exit For
    Next

    If colDrives.Count = 0 Then
        strMsg= "There are no Network Drives Mapped."
    Else
        strMsg = "Current network drive connections: " & CRLF  & CRLF
        For i = 0 To colDrives.Count - 1 Step 2
            strMsg = strMsg & colDrives(i) & Chr(9) & colDrives(i + 1) &
CRLF
        Next

    End If

 strMsg=strMsg & CRLF & "User/Computer Details:" & CRLF & CRLF & _
 "UserDomain"     & Chr(9) & "= " & WSHNetwork.UserDomain  & CRLF &   _
 "UserName"       & Chr(9) & "= " & WSHNetwork.UserName    & CRLF &   _
 "ComputerName"   & Chr(9) & "= " & WSHNetwork.ComputerName

set shell = createobject("wscript.shell")
shell.popup strMsg,5,"Your Connection Details",64

____________________________________________________________-

Gavin Jolly
Project Engineer/Webmaster
Ian Smith and Partners        Ph: 0064 4 566 8004
P.O. Box 30535                   Fax:0064 4 566 8037

New Zealand                        http://www.isp.co.nz/staff/gavin.html

Please visit our Web Site: http://www.isp.co.nz

Gavin Jolly
Project Engineer/Webmaster
Ian Smith and Partners        Ph: 0064 4 566 8004
P.O. Box 30535                   Fax:0064 4 566 8037

New Zealand                        http://www.isp.co.nz/staff/gavin.html

Please visit our Web Site: http://www.isp.co.nz



Fri, 08 Feb 2002 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Multiple groups drive letter mapping? (newbie question)

2. Deleting multiple mapped drives

3. map network drive & getFile

4. Mapping Net Drives with User Permission

5. A logon script that maps drives according to the users group memberships

6. WSH Map drive as different user?

7. Newbie - Mapping drives according to user and change default folders

8. ASP & Drive Mapping

9. map NW-drive with user and PW

10. Assign mapped drive, copy files, for all new users

11. Mapping drive to user's home directory

12. Mapping drive based off of OU and user name

 

 
Powered by phpBB® Forum Software