I’m attempting to automate some Treesize reports using powershell. I can run the report fine from the server, but if I try to do this remotely in a scriptblock it doesn’t run and I feel like I must be missing something small and silly.
Here is what I’m doing which seems to give me the correct syntax, but doesn’t do anything.
$target = computer2
$executable = “c:\program files (x86)\JAM Software\TreeSize Professional\treesize.exe”
$command = “$executable /Date /HTML `”\$target\c$\disk.html`" `"\$target\c$`""
invoke-command -computername computer2 -scriptblock {$executable}
Any tips on how to get this working?