Having some trouble with the syntax for compressing a folder and all its subfolders/files. The Win32_Directory WMI class has the method CompressEx which has a recursive parameter which is supposed to then compress all subfolders/files under the initial folder.
If I call
It compresses the folder %systemroot%\system32\LogFiles properly but of course without passing the Recursive parameter, it doesn't hit any of the subfolders/files. I'm not sure if this is just because it is Monday morning, but I can't for the life of me figure out how to pass the recursive boolean to this method. The method shows
uint32 CompressEx(
[out] string StopFileName,
[in, optional] string StartFileName,
[in, optional] boolean Recursive
);
I don't really care about the [out] but I'm thinking I'm getting caught up on the first optional [in] which I don't need as I'm already specifying the folder patch in the Get.
Anyone know the proper syntax for passing the recursive parameter?
If I call
Code:
(Get-WmiObject -class "Win32_Directory" -filter "name='$systemroot\\System32\\LogFiles'" -ErrorVariable errorstatus -ErrorAction SilentlyContinue).CompressEx()
It compresses the folder %systemroot%\system32\LogFiles properly but of course without passing the Recursive parameter, it doesn't hit any of the subfolders/files. I'm not sure if this is just because it is Monday morning, but I can't for the life of me figure out how to pass the recursive boolean to this method. The method shows
uint32 CompressEx(
[out] string StopFileName,
[in, optional] string StartFileName,
[in, optional] boolean Recursive
);
I don't really care about the [out] but I'm thinking I'm getting caught up on the first optional [in] which I don't need as I'm already specifying the folder patch in the Get.
Anyone know the proper syntax for passing the recursive parameter?