Try using this:
&"C:\test\7z.exe" x -aoa -y "$_.fullname" -o"\\server\output"
The &
is not very consistent with how it handles arguments, in my experience. Generally, though, you should assume that PowerShell doesn't strip quotes from arguments when you use &
. You should only use quotes when the program you're calling needs them in it's own arguments. In my script which archives IIS logs, I use this:
&"$7Zip" a "$ArchiveFile" "$FullLogPath\$LogFileSpec" -mx=9 -mmt=on
The variables are just path or file names. The quotes are there simply because path and file names can have spaces in them.
The way I usually figure it out is by Write-Host
the string that &
is going to call, then copy and pasting it into a cmd.exe
shell window