vbscript will not run from network

Posted on 2009-02-11
Last Modified: 2012-05-06
The script runs from locally fine but when I try to push it out using SMS or run it from a network share it will not work.
Option Explicit

Dim objWSHShell	:Set objWSHShell = CreateObject("WScript.Shell") 

Dim objFSO		:Set objFSO = CreateObject("Scripting.FileSystemObject")	

Dim winDir		:winDir=objWSHShell.ExpandEnvironmentStrings("%winDir%")

Dim userProfile	:userProfile=objWSHShell.ExpandEnvironmentStrings("%userProfile%")

Dim oFS

Set oFS       = WScript.CreateObject("Scripting.FileSystemObject")

If oFS.FileExists(userProfile &"\Application Data\Microsoft\Excel\Excel11.xlb") then oFS.DeleteFile(userProfile & "\Application Data\Microsoft\Excel\Excel11.xlb")

If oFS.FileExists(userProfile &"\Application Data\Microsoft\PowerPoint\PPT11.pcb") then oFS.DeleteFile(userProfile & "\Application Data\Microsoft\PowerPoint\PPT11.pcb")

If oFS.FileExists(userProfile &"\Application Data\Microsoft\templates\") then oFS.DeleteFile(userProfile & "\Application Data\Microsoft\templates\")

If oFS.FileExists(userProfile &"\Application Data\Microsoft\Excel\Excel12.xlb") then oFS.DeleteFile(userProfile & "\Application Data\Microsoft\Excel\Excel12.xlb")

If oFS.FileExists(userProfile &"\Application Data\Microsoft\PowerPoint\PPT12.pcb") then oFS.DeleteFile(userProfile & "\Application Data\Microsoft\PowerPoint\PPT12.pcb")

Open in new window

Question by:namilf
    1 Comment
    LVL 5

    Accepted Solution

    I would talk to the network administrator at your site and find out if their is a user policy that prevents them from running VB Scripts.  Most of the time if it runs locally on a development computer but not for users it is tied to the rights the user has on their computer.

    Featured Post

    Courses: Start Training Online With Pros, Today

    Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

    Join & Write a Comment

    Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    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…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    734 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

    24 Experts available now in Live!

    Get 1:1 Help Now