Re: ShortCut in desktop through Logon Script



Thank you Harvey.

Best Regards.

Luiz

"Harvey Colwell" wrote:

I agree that the simplest method is often the best. But there are times that
you may want something more elaborate, such as, built-in error checking.

Here's a generic "Push to Desktop" script I wrote a while back. I use it
within login scripts, but it can be ran as a standalone. Just pass it the
full path of the file you want to push out as the first command line
parameter. i.e.

cscript //nologo "Push To Desktop.vbs"
"\\servername\NETLOGON\URL\my_shortcut.lnk"


Line 26 is the vbScript equivalent to the DOS "copy" command.


NOTE: Each line of the script is numbered. If any is not, it was wrapped by
your email client. Append any such lines to the line directly above them
then remove the line numbers.

[--- Begin: Push to Desktop.VBS ---]

001. ' Windows Script Host - VBScript
002. '---------------------------------------------------------
003. ' Name: Push To Desktop.VBS
004. ' By: Harvey Colwell
005. ' Version: 1.0
006. ' CopyRight: (c) Apr 2002, All Rights Reserved!
007. '
008. '*********************************************************
009. Option Explicit
010.
011. Dim oWS, oFS
012.
013. Set oWS = WScript.CreateObject("WScript.Shell")
014. Set oFS = WScript.CreateObject("Scripting.FileSystemObject")
015.
016. Dim bDebug, sFile, sDest
017.
018. bDebug = FALSE
019.
020. If Not WSCript.Arguments.Count < 1 Then
021. sFile = WSCript.Arguments(0)
022. sDest = oWS.ExpandEnvironmentStrings("%ALLUSERSPROFILE%") & "\Desktop\"
023.
024. If IsFile(sFile) Then
025. If IsFolder(sDest) Then
026. oFS.CopyFile sFile, sDest, True
027. Else
028. ShowMsg "The All User Desktop Could not be found!" & vbCrLf & sFIle
029. End If
030. Else
031. ShowMsg "The specified file does not exist!" & vbCrLf & sFIle
032. End If
033.
034. Else
035. ShowMsg "No file was specified on the command line!"
036. End If
037.
038. Set oWS = Nothing
039. Set oFS = Nothing
040. WScript.Quit
041.
042. '---------------------
043. Sub ShowMsg(sMsg)
044. If bDebug Then MsgBox "ERROR: " & sMsg, vbInformation, "Debug Message"
045. End Sub
046.
047. '---------------------
048. Function IsFolder(fName)
049. If oFS.FolderExists(fName) Then IsFolder = True Else IsFolder = False
050. End Function
051.
052. '---------------------
053. Function IsFile(fName)
054. If oFS.FileExists(fName) Then IsFile = True Else IsFile = False
055. End Function

[--- End: Push to Desktop.VBS ---]


.



Relevant Pages

  • Re: ShortCut in desktop through Logon Script
    ... Here's a generic "Push to Desktop" script I wrote a while back. ... Just pass it the full path of the file you want to push out as the first command line parameter. ... Dim bDebug, sFile, sDest ... Set oWS = Nothing ...
    (microsoft.public.scripting.vbscript)
  • Re: convert to vbs
    ... I use this script exclusively from log in scripts. ... Set oWS = Nothing ...
    (microsoft.public.scripting.vbscript)
  • Re: convert to vbs
    ... Here's a generic "Push to Desktop" script I wrote a while back. ... Just pass it the full path of the file you want to push out as the first command line parameter. ... Dim bDebug, sFile, sDest ... Set oWS = Nothing ...
    (microsoft.public.scripting.vbscript)
  • Re: Deploying Red Hat Workstations
    ... > can easily make changes to the workstations all at once. ... Have the central server push out to each host. ... > This script will contain any changes that I need to make. ... I would automate SCP from the server to a user account (not ...
    (Fedora)
  • Re: many Array creations are slowing down
    ... Your script design is flawed in creating many Dateobjects and letting ... happen when there are thousands of other objects already in memory. ... I'm using "push" intentionally to store all created ... function tObject() { ...
    (microsoft.public.scripting.jscript)