Quantcast
Viewing all articles
Browse latest Browse all 21975

remove item command

I want to delete some files on multiple servers.How can i execute this commands on multiple server.

Remove-Item D:\vpm\* -include *sys.txt,error.txt,log.txt
get-childitem D:\vpm\*.* -include *.txt

If i use

PsExec  Remove-Item D:\vpm\* -include *sys.txt,error.txt,log.txt

i get an error saying "PsExec not a valid cmdlet.

I have also tried this code but this also doesn;t work.

Invoke-Command -computername "localhost" -Scriptblock {
Remove-Item D:\vpm\* -include *sys.txt,error.txt,log.txt
get-childitem D:\vpm\*.* -include *.txt
}


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>