Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Powershell Script to relocate User's Profile folder during Deprovision

$
0
0

Hi, 

I'm trying to write a script which, upon execution, move a user's profile folder from it's original location (in the \\server1\profile$ folder) into a sub folder in that location (server1\profile$\deprovisioned). We use Quest Activ Roles so it will be run during the user deprovisioning process. It doesn't seem like a particularly tricky thing to do but i just can't seem to get it working. So far i've come up with:

function onDeprovision($Request)

{

    if ($Request.class -eq "user")

    {

      $sAMAccountName = $Request.Get("sAMAccountName")

      Move-Item "\\server1\profile$\$sAMAccountName" "\\server1\profile$\Moved"  

    }

}

Does this look about right? If it is correctly formed then i can start looking into other reasons why it might not be working.

Thanks for the help



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>