function Hide-Folder{param($foldername)if(Test-Path $foldername){
class="MsoNormal"> $(Get-Item $foldername).Attributes = Hidden
}
else
{
Write-Error "The folder ($($foldername)) was not found."
}
}
The source of the .Attributes trick was:Get or set filedirectory attributes using Powershell