I'm trying to send a powershell output command to a text file. I need to add others output commands on one line when I execute a command.
In particular, I want send the output of this command:
Copy-Item -Verbose [fileName] -destination [path]
I tried to use:
$file = Copy-Item -Verbose [fileName] -destination [path]
add-Content $file [path] reportFile.txt
but the txt file is blank.
is it possibile to save the output of command "DETAILED: Execution of the "Copy file" to the destination etc...?
-PassThruswitch to have access to the objects being copied.