The reason I ask is that I have been researching how to rename items once an offline files target has been changed. It seems that so far there are two options:
- CSCCMD.exe - Which appears to be a legacy utility from XP
- WMI - The method I chose to go for as it seems more recent
I have been trying to do it in PowerShell with the following command, but keep getting errors. Perhaps you could help me debug it:
Invoke-WmiMethod -Class WIN32_OfflineFilesCache -Name RenameItem -ArgumentList ("\\server1\Share\john\", "\\server2\Documents\john\", $false)
I've been getting various errors, including COMException
and DirectoryNotFoundException
, though I think I have dealt with the latter.
That I have found, there doesn't seem to be a useful set of CMDlets or command-line tools to work with offline files. Am I over-complicating the situation by not using CSCCMD and is there a vlid reason why I have to go and find it on the web?
Yet a third option would be using the C++ native API instead of WMI.
The
RenameItem
method you're interested in is here.