Unable to remove a directory on network drive

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 7 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
User avatar
timo16
Posts: 8
Last visit: Tue Dec 20, 2016 4:35 am

Re: Unable to remove a directory on network drive

Post by timo16 »

Well I guess then I cannot use takeown, because the "server" in this case is a storage system, and the UNC-path refers to a volume on that storage. There is no drive letter to refer to. Only thing I could come up is to use the PSDrive to give it a temporary drive letter, but that doesn't work :|
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Unable to remove a directory on network drive

Post by jvierra »

If it is a Windows file storage system then the folder has a local path. You need to get the folder path and use that.

Get-WmiObject Win32_Share -ComputerName $server.

WMI will tell you the local path. You must be an administrator on the target system. There is no other way to change ownership of a folder or file. Only administrators on the file server can do this.
User avatar
timo16
Posts: 8
Last visit: Tue Dec 20, 2016 4:35 am

Re: Unable to remove a directory on network drive

Post by timo16 »

Unfortunately it is a NetApp storage system. It does have it's own PowerShell CmdLets for management though, but I would much rather use the built in ones that exist in Windows/PowerShell.
jvierra
Posts: 15439
Last visit: Tue Nov 21, 2023 6:37 pm
Answers: 30
Has voted: 4 times
Been upvoted: 33 times

Re: Unable to remove a directory on network drive

Post by jvierra »

timo16 wrote:Unfortunately it is a NetApp storage system. It does have it's own PowerShell CmdLets for management though, but I would much rather use the built in ones that exist in Windows/PowerShell.
I do not understand what you are trying to say. It does not matter. You still must be an administrator. TAKEOWN is built into all Windows OSs.
This topic is 7 years and 3 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked