So i'm trying to delete a few remote folders but am running into permission issues.
I've tried:
Get-ChildItem \\$Comp\c$\eQube-Tools -Force | Remove-Item -Recurse
Get-ChildItem \\$Comp\c$\Gecko -Force | Remove-Item -Recurse
Remove-Item \\$Comp\c$\eQube-Tools -Force -Recurse
Remove-Item \\$Comp\c$\Gecko -Force -Recurse
But that gave me permission errors, So i added:
takeown /a /r /d Y /f \\$Comp\c$\eQube-Tools
takeown /a /r /d Y /f \\$Comp\c$\Gecko
Only to get:RemoveItem Error
About it being not empty.. i was reading that:
Remove-Item \\$Comp\c$\eQube-Tools -Force -Recurse
would delete the empty folder that:
Get-ChildItem \\$Comp\c$\eQube-Tools -Force | Remove-Item -Recurse
had created.
I did look into the ownership of the folders:Folder Owner **the only issues i can see is with the owner being the built in Admin Account
Im open to using:
rmdir (tried using psexec with this, this was my first attempt)
Object.Delete() *this is going to be my next try
My setup is:
Local Account: Administrator
Win 10 laptop running the code (PSVer 5.1)
on a workgroup
Remote Units: \\ip\C$ i can delete the folders fine this way (once the program has been killed)
Local Account: Administrator
Win 7 Home
Workgroup
PSver 2.0