Copy file to Domain user desktop by using Group Policy

Copy file to Domain user Desktop using .vbs script from Group Policy

Option Explicit

Dim objNetwork
Dim objFSO, objFileCopy, objGuyFile
Dim strFilePath, strDestination, strUserName
Set objNetwork = WScript.CreateObject(“WScript.Network”)
‘ Here is where we extract the UserName
strUserName = objNetwork.UserName
strFilePath = “\\servername\Desktop\BACK.bat
strDestination =”C:\Documents and Settings\” & strUserName & “\Desktop\”

Set objFSO = CreateObject(“Scripting.FileSystemObject”)

Set objFileCopy = objFSO.GetFile(strFilePath)
‘ Copy the file to its destination
objFileCopy.Copy (strDestination)
‘WSCript.Echo “Copied to ” & strDestination
Wscript.Quit

Advertisements

5 Responses to Copy file to Domain user desktop by using Group Policy

  1. IT Guy says:

    Thanks, this saved me a lot of time, once I figured out to change the ‘ and ” from the fancy font to the generic text in notepad, works great!

  2. Alex says:

    Hi Asif

    I need the similar thing but instead of user I want every desktop c:\ . Any idea?

    Thanks
    Alex

    • ASIF says:

      Sorry for late reply. Changing destination path you can do it.

      strDestination =”C:\Documents and Settings\” & strUserName & “\Desktop\”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: