0
I want to clean a website before a deploy. In order to do that, I use WMIC to run remotely and Powershell to remove all the files except some specific ones:
WMIC /node:server /user:user /password:pass process call create "powershell -Command 'Get-ChildItem C:\Optima-QA2 -File -Name -Recurse -Force -Exclude .*\.7z, .*\.lic, [Ww]eb\.config | foreach($_) {remove-item $_}'"
but it seems to have problems with the pipe and the foreach, to parse and catch properly the command.
How can I do that? Is there other possibility to clean a website using regex for exclusions? PsExec is not working in the environment, so it's not an option to me, I'm afraid.