Question : VB Script  - Drop Shortcut on All User Deskop

We have two type of workstations in our enterprise environment.

1. Kiosks - Locked down workstations logged into a generic single user account.
2. Administrative - Workstations that users can indivdually log onto. Usually a specific person is assigned to this type of device.

I would like to drop an htm file on the desktop on both types. The script I currently have is designed to first check if the computername matches the username, if so then it copies it to the kiosks desktop. If this is not the case then it automatically drops onto the administrative computers all users\desktop folder.

Currently it works for the kiosk workstation but not on the administrative. Any thoughts as to why this might be occuring?


Option Explicit

'On Error Resume Next

Dim oNetwork, strComputer, strUsername
Dim strDesktopLNK, strStartMenuLNK, strDefaultLNK
Dim objWMIService, colOSInfo
Dim oFSO, oShell, oLink, objItem, strOS

Set oNetwork = createObject("Wscript.network")
strComputer = oNetwork.ComputerName

Set oFSO = Wscript.CreateObject("Scripting.FileSystemObject")
Set oShell = WScript.CreateObject("WScript.Shell")


If oFSO.FolderExists("C:\Documents and Settings\" & strComputer & "\Desktop") Then

    strDesktopLNK = "C:\Documents and Settings\" & strComputer & "\Desktop\shortcut.lnk"
 
    SET oLink = oShell.CreateShortcut(strDesktopLNK)
    oLink.TargetPath = chr(34) & "c:\program files\internet explorer\iexplore.exe" & chr(34)
    oLink.Arguments = "URL"
    oLink.WorkingDirectory = chr(34) & "c:\program files\internet explorer\" & chr(34)
    oLink.IconLocation = "C:\Windows\System32\shell32.dll, 21"
    oLink.Save

    strStartMenuLNK = "C:\Documents and Settings\" & strComputer & "\Start Menu\Programs\shortcut.lnk"
 
    SET oLink = oShell.CreateShortcut(strStartMenuLNK)
    oLink.TargetPath = chr(34) & "c:\program files\internet explorer\iexplore.exe" & chr(34)
    oLink.Arguments = "URL"
    oLink.WorkingDirectory = chr(34) & "c:\program files\internet explorer\" & chr(34)
    oLink.IconLocation = "C:\Windows\System32\shell32.dll, 21"
    oLink.Save

Else

    strDefaultLNK = "C:\Documents and Settings\All User\Desktop\shortcut.lnk"

    SET oLink = oShell.CreateShortcut(strDefaultLNK)
    oLink.TargetPath = chr(34) & "c:\program files\internet explorer\iexplore.exe" & chr(34)
    oLink.Arguments = "URL"
    oLink.WorkingDirectory = chr(34) & "c:\program files\internet explorer\" & chr(34)
    oLink.IconLocation = "C:\Windows\System32\shell32.dll, 21"
    oLink.Save

    strDefaultLNK_SM = "C:\Documents and Settings\All User\Start Menu\shortcut.lnk"

    SET oLink = oShell.CreateShortcut(strDefaultLNK_SM)
    oLink.TargetPath = chr(34) & "c:\program files\internet explorer\iexplore.exe" & chr(34)
    oLink.Arguments = "URL"
    oLink.WorkingDirectory = chr(34) & "c:\program files\internet explorer\" & chr(34)
    oLink.IconLocation = "C:\Windows\System32\shell32.dll, 21"
    oLink.Save

End If

Answer : VB Script  - Drop Shortcut on All User Deskop

Sorry Experts... I found the solution elsewhere.

For your reference, here is the link to it...
http://www.visualstudiodev.com/visual-basic-express-edition/trying-to-debug-receive-requested-operation-requires-elevation-48897.shtml

This is the part that helped me...
Does you application have the words "setup",  "update", "install", or any of the other key phrases that Vista uses in  its heuristics to identify setup programs? If so, you don't need to run  Visual Studio as an administrator. You just need to either change the  name of your program or add a manifest file (which is difficult under VS  2005 editions) and mark it so that Vista UAC doesn't perform heuristics  testing on it.

The name of my app had the word Update in it...

Thank to anyone that was trying to find a solution for me.

Take care!
Random Solutions  
 
programming4us programming4us