Hello, I'm trying to put together a file cleanup and compress script and am having trouble getting the compression piece to work correctly. I'm also not getting an error to go off of so I'm looking for some help and direction. This is what I have right now. My goal is to cycle through the paths listed and compress only those directories that are not already compressed. When I run this I get no output or errors. The script just hangs. I've tested on several windows 2k8 servers with the same result. Am I missing something here? Any help would be greatly appreciated.
$dr1="C:\windows\assembly"$dr2="C:\windows\installer"
$dr3="C:\Windows\Logs\DISM"
$dr4="D:\Program Files\VERITAS\Patch"
$dr5="D:\Interwoven\OpenDeployNG\log'"
$folderstocompress = get-wmiobject -Query "select * from Win32_Directory where Name = 'dr1' or Name = 'dr2' or name = 'dr3' or name = 'dr4' or name = 'dr5'"
foreach ($folder in $folderstocompress)
{
if($folder.compressed = $false)
{
$folder.compress()
}
}