AllUsers VB script issue
Hello Everyone,
I'm rolling out Media Player 10 to my users on a XP image.
After install a icon appears under \All Users\Start Menu\Programs\Windows Media Player.lnk then a new folder and icon are created here: \All Users\Start Menu\Programs\Accessories\Entertainment\Windows Media Player.lnk.
I need to delete the icon under ALLUsers\Programs, then move the icon that is in the Entertainment folder to the Accessories\Multimedia , then delete the Entertainment folder. Of course my script isn't working.
thanks
--------------------------------------------------------------------------------------------------
Dim wshShell, objFSO, objShell2, objFolder, objFolderItem
Const DeleteReadOnly=True
Const OverwriteExisting = True
Const ALLUsers=&H16&
strComputer = "."
Set wshShell=CreateObject("Wscript.Shell")
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objShell2=CreateObject("Shell.Application")
Set objFolder=objShell2.Namespace(ALLUsers)
Set objFolderItem=objFolder.Self
ON Error Resume Next
'wscript.echo "path = " & objFolderItem.Path
strFilePath = objFolderItem.Path & "\Start Menu\Programs\Accessories\Entertainment\Windows Media Player.lnk"
strDestination =objFolderItem.Path & "\Start Menu\Programs\Accessories\Multimedia\Windows Media Player.lnk"
If objFSO.FileExists(strFilePath) Then
' Wscript.Echo "copying lnk"
objFSO.CopyFile strFilePath , strDestination, OverwriteExisting
End if
If objFSO.FileExists(objFolderItem.Path & "\Start Menu\Programs\Windows Media Player.lnk") Then
Wscript.Echo "deleting old lnk"
objFSO.DeleteFile(objFolderItem.Path & "\Start Menu\Programs\Windows Media Player.lnk"), DeleteReadOnly
End if
If objFSO.FileExists(objFolderItem.Path & "\Start Menu\Programs\Accessories\Entertainment\Windows Media Player.lnk") Then
Wscript.Echo "deleting second old lnk"
objFSO.DeleteFile(objFolderItem.Path & "\Start Menu\Programs\Accessories\Entertainment\Windows Media Player.lnk"), DeleteReadOnly
End if
If objFSO.FolderExists(objFolderItem.Path & "\Start Menu\Programs\Accessories\Entertainment") Then
Wscript.Echo "deleting folder"
objFSO.DeleteFolder(objFolderItem.Path & "\Start Menu\Programs\Accessories\Entertainment")
End if
Wscript.quit
I'm rolling out Media Player 10 to my users on a XP image.
After install a icon appears under \All Users\Start Menu\Programs\Windows Media Player.lnk then a new folder and icon are created here: \All Users\Start Menu\Programs\Accessories\Entertainment\Windows Media Player.lnk.
I need to delete the icon under ALLUsers\Programs, then move the icon that is in the Entertainment folder to the Accessories\Multimedia , then delete the Entertainment folder. Of course my script isn't working.
thanks
--------------------------------------------------------------------------------------------------
Dim wshShell, objFSO, objShell2, objFolder, objFolderItem
Const DeleteReadOnly=True
Const OverwriteExisting = True
Const ALLUsers=&H16&
strComputer = "."
Set wshShell=CreateObject("Wscript.Shell")
Set objFSO=CreateObject("Scripting.FileSystemObject")
Set objShell2=CreateObject("Shell.Application")
Set objFolder=objShell2.Namespace(ALLUsers)
Set objFolderItem=objFolder.Self
ON Error Resume Next
'wscript.echo "path = " & objFolderItem.Path
strFilePath = objFolderItem.Path & "\Start Menu\Programs\Accessories\Entertainment\Windows Media Player.lnk"
strDestination =objFolderItem.Path & "\Start Menu\Programs\Accessories\Multimedia\Windows Media Player.lnk"
If objFSO.FileExists(strFilePath) Then
' Wscript.Echo "copying lnk"
objFSO.CopyFile strFilePath , strDestination, OverwriteExisting
End if
If objFSO.FileExists(objFolderItem.Path & "\Start Menu\Programs\Windows Media Player.lnk") Then
Wscript.Echo "deleting old lnk"
objFSO.DeleteFile(objFolderItem.Path & "\Start Menu\Programs\Windows Media Player.lnk"), DeleteReadOnly
End if
If objFSO.FileExists(objFolderItem.Path & "\Start Menu\Programs\Accessories\Entertainment\Windows Media Player.lnk") Then
Wscript.Echo "deleting second old lnk"
objFSO.DeleteFile(objFolderItem.Path & "\Start Menu\Programs\Accessories\Entertainment\Windows Media Player.lnk"), DeleteReadOnly
End if
If objFSO.FolderExists(objFolderItem.Path & "\Start Menu\Programs\Accessories\Entertainment") Then
Wscript.Echo "deleting folder"
objFSO.DeleteFolder(objFolderItem.Path & "\Start Menu\Programs\Accessories\Entertainment")
End if
Wscript.quit
0 Comments
[ + ] Show comments
Answers (3)
Please log in to answer
Posted by:
aogilmor
16 years ago
Posted by:
aogilmor
16 years ago
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
so that the conversation will remain readable.