title: Rename-Item is not working
body: <p>I have a share on a folder at path <code>\\Srv1011\User0$</code> (Active Directory) and I want to rename it with another name <code>\\Srv1011\User1$</code> but it is not working for me.</p>
  
  <p>Code is:</p>
  
  <pre><code>Rename-Item -Path \\Srv1011\User0$ -NewName \\Srv1011\User1$
  </code></pre>
  
  <p>Right now the share is enable on the folder and if I execute the above command I get this error:</p>
  
  <pre>
  Rename-Item : Object reference not set to an instance of an object.
  At line:1 char:1
  + Rename-Item -Path \\srv13577\User0$ -NewName \\srv13577\User1$
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : NotSpecified: (:) [Rename-Item], NullReferenceException
      + FullyQualifiedErrorId : System.NullReferenceException,Microsoft.PowerShell.Commands.RenameItemCommand
  </pre>
  
  <p>But If I remove the share from folder I get the following error:</p>
  
  <pre>
  Rename-Item : Cannot rename because item at '\\srv13577\User0$' does not exist.
  At line:1 char:1
  + Rename-Item -Path \\srv13577\User0$ -NewName \\srv13577\User1$
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      + CategoryInfo          : InvalidOperation: (:) [Rename-Item], PSInvalidOperationException
      + FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.RenameItemCommand
  </pre>
  
  <p>Right now I am not sure how to rename such folder. My original work is to drop the share, rename the folder and create the share back.
  But for now I am stuck with renaming.</p>