Deployment and Imaging Group

 View Only

Map Drive Depending on IP ADDRESS for Site Based Software Repositories 

Jun 29, 2011 12:54 PM

To migrate to DS 7.1 I've had to create a VBScript task for creating a mapped drive to the previous site based software repositories that we used in DS 6.9 depending on IP address.

This has helped me migrate quickly and allowed me to continue using our current structure while testing with DS 7.1

' vbscript
On Error Resume Next

'*************************************************************************************
' SITE DEPOT DETAILS
''************************************************************************************
' A Script for Creating a mapped drive depending on IP ADDRESS
' Examples for each part of the IP ADDRESS e.g. IP of 10.20.30.40
' IPPart(0) = 10, IPPart(1) = 20, IPPart(2) = 30, IPPart(3) = 40
' Altiris_Depot is the name of the local site based Software Repository.

dim TestIP
dim IPPart
dim Altiris_Depot
dim lntRowsUpdated
dim objNetwork
dim strRemoteShare
dim strLocalDrive

Set objNetwork = WScript.CreateObject("WScript.Network")
IntRowsUpdated = 0

TestIP = "%AGENTIPADDR%"
strLocalDrive = "Z:"  ' Designated DRIVE for DEPOT
IPPart = Split(TestIP,".", -1, 1)

If IPPart(0) = "172" Then ' CHECK THE LOCATION THEY ARE IN
 Select Case IPPart(1)
    case "22" ' LOCATION NAME 1
        Altiris_Depot = "DEPOT-SVR-1"
    case "70" ' LOCATION NAME 2
        Altiris_Depot = "DEPOT-SVR-2"
    case "24" ' LOCATION NAME 3
        Altiris_Depot = "DEPOT-SVR-3"
       
        Select Case IPPart(2)
        case "58" ' SUB LOCATION 1
            Altiris_Depot = "DEPOT-SVR-4"
        Case "46" ' SUB LOCATION 2
            Altiris_Depot = "DEPOT-SVR-5"
        Case Else ' all others
            Altiris_Depot = "HOME-SRV"
        End Select
       
    Case Else
        Altiris_Depot = "HOME-SRV"
    End Select
ElseIf IPPart(0) = "10" Then ' CHECK THEY ARE FROM A 3RD PARTY COMPANY SITE
 Select Case IPPart(1)
    case "70" ' LOCAL1
        Altiris_Depot = "C2-DEPOT-SVR-1"
    case "90" ' LOCAL2
        Altiris_Depot = "C2-DEPOT-SVR-2"
    case "91" ' LOCAL3
        Altiris_Depot = "C2-DEPOT-SVR-3"
   
    Case Else
        Altiris_Depot = "HOME-SRV"
    End Select
Else  ' all others
    Altiris_Depot = "HOME-SRV"
End if

strRemoteShare = "\\" & Altiris_Depot & "\Depot"
objNetwork.MapNetworkDrive strLocalDrive, strRemoteShare, False 

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.