Question Locked

running defrag via psexec

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I am using psexec to run a remote command to defrag computers on our network, but i want the output into a text file so i can review them afterwards instead of watching the screen run. the problem i have is that the .txt file will be overwritten each time it starts a defreag on a new machine.

How can i get it to name the text file the same name as the computername?? i have tried %computername% but this just save the file as the local compuer name....

'psexec @computerlist.txt -u username -p password Defrag c: /f >%computername%.txt'

Please help.

thanks

2 replies

by mjandrion

You have to pipe to file:
>> appends and creates file
ipconfig >> c:\test.txt
> creates and overwrites
ipconfig > c:\test.txt

Good luck. Matt

This discussion is closed to new replies.