SMS 2003 VBScript Deployment Issue

Posted on 2009-04-28
Last Modified: 2013-11-21
I am wanting to deploy a vbscript that will change a drive mapping location without changing the drive letter.  I have tested the script and it works.  When I create a SMS package I also create a program that runs cscript test.vbs.  It shows that it runs and installs fine with no errors, but the script doesn't actually run.  Is there something that I am missing in the package?  Any help would be appreciated.
Dim oNetwork, oDrive, iDrive, bKeepInProfile

Dim sDriveLetter, sOldPath, sNewPath

sDriveLetter = ""

sOldPath = "\\OLDPATH"

sNewPath = "\\NEWPATH

bKeepInProfile = True

Set oNetwork = CreateObject("WScript.Network") 

Set oDrive = oNetwork.EnumNetworkDrives

If oDrive.Count > 0 Then

	For iDrive = 1 to oDrive.Count - 1

		If UCase(oDrive.Item(iDrive)) = UCase(sOldPath) Then

			sDriveLetter = oDrive.Item(iDrive-1)

			oNetwork.RemoveNetworkDrive oDrive.Item(iDrive-1), True, True

		End If



End If

If sDriveLetter <> "" Then

	oNetwork.MapNetworkDrive sDriveLetter, sNewPath, bKeepInProfile


End If

Set oDrive = Nothing

Set oNetwork = Nothing

Open in new window

Question by:baguthrie
    LVL 22

    Expert Comment

    by:Adam Leinss
    Under what account are you running the package, is it SYSTEM or user privileges?
    LVL 4

    Author Comment

    I have it running under a service account that we have created and it is a local admin on the box.  I know the account itself has the privileges because we have distributed packages before.
    LVL 22

    Accepted Solution

    In the package itself, you can either run programs under local system or the logged in user.  I'm guessing you want to run the package under the logged in user, as local system won't have access to network drives.
    This is separate from the client access and network accounts.
    LVL 4

    Author Comment

    thanks for your help.  that was it.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Some time ago I faced the need to use a uniform folder structure that spanned across numerous sites of an enterprise to be used as a common repository for the Software packages of the Configuration Manager 2007 infrastructure. Because the procedu…
    Join Greg Farro and Ethan Banks from Packet Pushers ( and Greg Ross from Paessler ( for a discussion about smart network …
    As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
    With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now