Generate log verbose after Move-item

Welcome Forums General PowerShell Q&A Generate log verbose after Move-item

  • This topic has 7 replies, 5 voices, and was last updated 1 year ago by
    Participant
    .
Viewing 6 reply threads
  • Author
    Posts
    • #175870
      Participant
      Topics: 2
      Replies: 3
      Points: 29
      Rank: Member

      Hello Guys ,

       

      I need export log after move-item

      Ex:

      Move-Item *.rar -Destination $DiretoryBackupAM -Verbose | Add-Content F:\SRV-AM\log.txt

      But in log file no show verbose details.

      Are you can help me ?

    • #175885
      Participant
      Topics: 11
      Replies: 127
      Points: 761
      Helping Hand
      Rank: Major Contributor

      Verbose messages only show in their own output stream, so you need to redirect the output to standard output for it to show in the log.

      See: https://devblogs.microsoft.com/scripting/understanding-streams-redirection-and-write-host-in-powershell/

    • #175888
      Participant
      Topics: 7
      Replies: 2458
      Points: 6,439
      Helping Hand
      Rank: Community MVP

      … or you make your life easier and use robocopy … it’s made for … it’s faster … and writes a decent/good readable log for you if you want. 😉

    • #175894
      Participant
      Topics: 0
      Replies: 115
      Points: 433
      Helping Hand
      Rank: Contributor

      Macros,

      You can also use Start-Transcript at the beginning of the move process.Below is an example.

      • #175951
        Participant
        Topics: 2
        Replies: 3
        Points: 29
        Rank: Member

        This option is best for me

    • #175903
      Participant
      Topics: 51
      Replies: 209
      Points: 860
      Helping Hand
      Rank: Major Contributor
    • #175927
      Participant
      Topics: 0
      Replies: 115
      Points: 433
      Helping Hand
      Rank: Contributor

      Marcos,

      In case it wasn’t obvious stream redirection is the preferred method. Below is what you would do.

    • #175957
      Participant
      Topics: 7
      Replies: 2458
      Points: 6,439
      Helping Hand
      Rank: Community MVP

      This option is best for me

      Really? Wow. 😉

Viewing 6 reply threads
  • The topic ‘Generate log verbose after Move-item’ is closed to new replies.