We are trying to tidy up our home user directories and speed up work in Office 2007 by moving all their templates to a new directory on our user drive (U :). During my initial tests, I can get the below script to work fine, although it has an obvious problem only for working with my username. Is there a way to get him to take the current user login? Before this will be processed by% username% and from a short-term scan of the Internet, obviously:
$[Environment]::UserName
Must work. However, it seems I am getting errors. Is there a better way to achieve the current login in the username in the file path?
if (!(Test-Path -path '\\SERVER\PATH\TO FILES\$[Environment]::UserName\Normal\'))
{
New-Item '\\SERVER\PATH\TO FILES\$[Environment]::UserName\Normal\' -type directory
}
else
{
"No work to do"
}