Link to home
Create AccountLog in
Avatar of AstraZeneca
AstraZeneca

asked on

Distributing vbs files through sms 2003

I have a *.vbs file that updates shortcuts on the w2k Desktop and favourites with new URL.  This works okay when run from the server location.  However when I create and advertise the package in SMS.  The script does not apply, SMS reports say succssful.  I have tried an exe version of the same file.  Same result.  I have also tried wscript in the SMS command line.  I have created various SMS packages in the past however I have never been successful with a vbs or bat file.  Please assist.  
on error resume next
Set oShell = CreateObject("WScript.Shell")
set oFso = CreateObject("Scripting.FilesystemObject")
 
sPath = oShell.SpecialFolders("Desktop")
ChkLnk(sPath)
 
sPath = oShell.SpecialFolders("AllUsersDesktop")
ChkLnk(sPath)
 
sPath = oShell.SpecialFolders("Favorites")
ChkLnk(sPath)
 
Sub ChkLnk (sFolder)
  Set oFolder = oFso.GetFolder(sFolder)
  Set oFiles = oFolder.Files
 
  For Each oFile In oFiles
    If LCase(oFso.GetExtensionName(oFile)) = "url" Then
      Set oLnk = oShell.CreateShortcut(oFile)
      If InStr(LCase(oLnk.TargetPath),"ausysrohan/infraenterprise/infraenterprise") > 0 Then
        oLnk.TargetPath = Replace(LCase(oLnk.TargetPath),"ausysrohan","ausysinfisp01")
        oLnk.Save
      End If
    End If
  Next
End Sub

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of merowinger
merowinger
Flag of Germany image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Avatar of AstraZeneca
AstraZeneca

ASKER

Thanks 4 that yes had the set oshell, used the msgbox and showing the correct path for w2k c:\d&s|username\desktop works manually as per usual.
This was an SMS permissions error, took a lot of trail and error and it finally worked.  Choose User rights and only when user logged in