Coming Soon: GET-IT: Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET Coming Soon: GET-IT: Endpoint Management 1-Day Conference on September 28th at 9:30 AM ET

Copy folder to many AD computer

Home Forums Scripting DOS Command Shell Copy folder to many AD computer

Viewing 1 post (of 1 total)
  • Author
    Posts

  • zonemaster24
    Member
    #167685

    Hi anyone there i’m newbie, can any one help me what is the problem on this code.
    because i want to copy a folder to many domain computer with a list of ip address on text file. I wanted to ping first the ip and if no error it will proceed to copy file to the default destination.
    Also after successfull it will proceed to the next ip address, with create logs for all ip mark to be ok. However it say access denied. to the ip address and i need to map first the ip address and enter the username and password and check the credential before i the batch file to be success.

    Here the code i make.

    [USER=”68995″]Echo[/USER] off

    :BEGIN
    SET PCLIST=pclist.txt

    PING -n 1 %PCLIST% >nul
    IF %ERRORLEVEL%==0 (
    GOTO INSTALL
    ) ELSE IF %ERRORLEVEL%==1 (
    GOTO END
    )

    :INSTALL
    for /F “tokens=*” %%1 in (pclist.txt) do (
    echo Copying files to %%1
    MD “\%%1c$Rainmeter”
    xcopy “C:DeploymentRainmeter*.*” “\%%1c$Rainmeter” /e /c /f /h /g /y /r
    xcopy “C:DeploymentRainmeterRainmeter.lnk” “\%%1c$ProgramDataMicrosoftWindowsStart MenuProgramsStartUp” /d /y

    MD “\%%1d$Desktop”
    xcopy “C:DeploymentRainmeterDesktop*.*” “\%%1d$Desktop” /e /c /f /h /g /y /r

    icacls “\%%1d$Desktop” /grant Everyone:M

    echo %Date% >>C:Deploymentmakelog.txt %Time% >>C:Deploymentmakelog.txt

    )
    :END
    exit

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

Live Webinar: Active Directory Security: What Needs Immediate Priority!Live on Tuesday, October 12th at 1 PM ET

Attacks on Active Directory are at an all-time high. Companies that are not taking heed are being punished, both monetarily and with loss of production.

In this webinar, you will learn:

  • How to prioritize vulnerability management
  • What attackers are leveraging to breach organizations
  • Where Active Directory security needs immediate attention
  • Overall strategy to secure your environment and keep it secured

Sponsored by: