what am I doing wrong here

Welcome Forums General PowerShell Q&A what am I doing wrong here

This topic contains 1 reply, has 2 voices, and was last updated by

3 years, 10 months ago.

  • Author
  • #23872

    Points: 0
    Rank: Member

    i want to copy IIS logs from multiple app servers and dump them into one place. The script will run at the destination server. Hence, I wrote the script below. However, instead of going through one element in the array at a time, powershell treats everything as 1 element. How can I fix this issue? Any help would be appreciated,.


    $unCA = "\\", "\\", "\\", "\\", "\\", "\\"
    $unCB = "\\"
    $source = "C$\inetpub\logs\LogFiles\W3SVC1\*.log"
    $destination = "E$\"
    foreach ($element in $unCA) {
    copy-item $uncA\$source $uncB\$destination

  • #23873

    Points: 0
    Rank: Member

    This line:

    copy-item $uncA\$source $uncB\$destination

    Should probably be this:

    copy-item $element\$source $uncB\$destination

The topic ‘what am I doing wrong here’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort