Hello everyone,
The script Robert was able to share with me worked once I removed just a few things making it look a little like this:
Get-VM | `
Where-Object {$_.PowerState -eq "PoweredOn" -and $_.Guest.OSFullName -like "*Windows*"} | `
Invoke-VMscript -ScriptText "del c:\test\test.exe" -ScriptType bat
After reading LucD's post, I thought I'd try removing the credential parameters completely. With these gone, once I connect to a specific host and execute the script, it prompts me for the guest OS credentials just once. After I enter in those manually, the script performs admirably, removing the files across all the VMs regardless of the VM configuration. The script I wrote was bunk, and using Invoke-VMscript from Robert definitely does the trick.
I did still have one last issue though which has been giving me a great deal of trouble. I understand that this is a batch file script and so it doesn't parse spaces. For example, when trying to delete a file in a filepath such as "c:\documents and settings\test.exe", I would get the "The system cannot find the file specified" message.
I've tried enclosing the filepath in quotations with something like:
"del "c:\documents and settings\text.exe""
as well as other variations on the theme but I can't seem to nail it.
Would you guys be able to help me overcome this last hurdle? You've been tremendous help with this already.
Best regards