Powershell file search and delete in remote pc's -


need in searching file , delete it. beginner in power shell. trying delete file name somename.txt in remote pc's. able search file , output. not able delete file , need exclude c:\windows search. looking possible solution.

$strcomputers = get-content -path "c:\testscripts\serverlist.txt" foreach($strcomputer in $strcomputers) {     $files = gci "\\$strcomputer\c$" -filter "somename.txt" -recurse -force     $file = $files | ft fullname -wrap|out-file c:\testscripts\output.txt -width 200 -append     $files | foreach { remove-item $_.fullname -force} }  

thanks..


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -