Home All Groups Group Topic Archive Search About

Copy file from server to workstation at logon



Author
21 Nov 2007 3:31 PM
116
Can someone help regarding a file I would like copied to the local PC
everytime they logon to the domain.

Server is 2000 and using active directory

Thanks

Author
21 Nov 2007 7:50 PM
Jeffery Hicks [MVP]
As long as the user has read permissions on the network share and write
permissions to the local directory, you can get by with a simple COPY
command in a batch file.  Create a simple script and a GPO to run it as a
logon script. Or is there more to this question than meets the eye?

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.
Show quote
"116" <1**@discussions.microsoft.com> wrote in message
news:16AB0EBA-7D55-4C25-95EA-0C749B604D8F@microsoft.com...
> Can someone help regarding a file I would like copied to the local PC
> everytime they logon to the domain.
>
> Server is 2000 and using active directory
>
> Thanks
Author
21 Nov 2007 7:52 PM
Jeffery Hicks [MVP]
One other approach would be to create a scheduled task set to run on logon
that runs the script.  This would get around any permission issues because
you could specify credentials.  You could also remotely setup the task using
SCHTASKS.EXE.

--
Jeffery Hicks
Microsoft PowerShell MVP
http://www.scriptinganswers.com
http://www.powershellcommunity.org

Now Available: WSH and VBScript Core: TFM
Coming Soon: Windows PowerShell: TFM 2nd Ed.


Show quote
"116" <1**@discussions.microsoft.com> wrote in message
news:16AB0EBA-7D55-4C25-95EA-0C749B604D8F@microsoft.com...
> Can someone help regarding a file I would like copied to the local PC
> everytime they logon to the domain.
>
> Server is 2000 and using active directory
>
> Thanks
Author
22 Nov 2007 5:25 AM
Imran
On Nov 21, 7:31 pm, 116 <1***@discussions.microsoft.com> wrote:
> Can someone help regarding a file I would like copied to the local PC
> everytime they logon to the domain.
>
> Server is 2000 and using active directory
>
> Thanks

Try this script. Create a new GPO and apply on the OU containing the
target computer. In that GPO, create a new startup script under
Computer Configuration, and apply this script. Change the server,
share, file and target names. This script copies the file to Windows
folder of the target computer.

'-----------Script starts---------------
on error resume next
Const OverwriteExisting = TRUE
strComputer = "."
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root
\cimv2")
Set colSettings = objWMIService.ExecQuery _
    ("Select * from Win32_OperatingSystem")

For Each objOperatingSystem in colSettings
objFSO.CopyFile "\\server\share
\file.ext" ,objOperatingSystem.WindowsDirectory & "\" ,
OverwriteExisting
Next

set objFSO = null
set objWMIService = null
set colSettings = null
'---------------Script ends-----------------

AddThis Social Bookmark Button