Category Archives: File system

Long file paths

Long file paths – greater than 260 characters – have been a pain to deal with in Windows. There is an argument that you should avoid file paths of that length but sometimes you don’t have any choice – when … Continue reading

Posted in File system, PowerShell v5 | 1 Comment

Splitting paths

PowerShell has the Split-Path cmdlet that provides the leaf and parent of a path. But what if you’re splitting paths and need one or paths at a higher level. Consider the path PS> $path = ‘C:\Scripts\HyperV\Admin\Optimize-VMDisks.ps1’ Its just an arbitrary … Continue reading

Posted in File system, Powershell | Leave a comment

Get Folder sizes

One problem that comes up quite often is how do you get folder sizes. One option is use Measure-Object but the problem with that approach is that its going to be a pretty slow process if you have a lot … Continue reading

Posted in File system, Powershell | 2 Comments

Blocksize missing?

I recently had a question asking why the Bloacksize property on Win32_LogicalDisk is empty but is populated on Win32_Volume. The thing is to remember the underlying thing that these 2 CIM classes represent. A logical disk is a subdivision of … Continue reading

Posted in CIM, File system | Leave a comment

Copy a file with WMI

A question came up on the forum about copying files with CIM (WMI). I normally use Copy-Item rather than CIM as its easier. The questioner was using CIM_LogicalFile when I’ve normally used CIM_DataFile so I decided to take a look … Continue reading

Posted in CIM, File system, PowerShell and WMI | Leave a comment

Awkward file and folder names

Spent some time today dealing with a situation where there were special characters – namely [ ] in folder a file names £> Get-ChildItem -Path C:\Test     Directory: C:\Test Mode                LastWriteTime     Length Name—-                ————-     —— —-d—-        21/01/2015     17:58            Awkward [One]d—-        … Continue reading

Posted in File system, Powershell Basics | Leave a comment

Finding a file version

Interesting question on the forum – how to find the file version of IE on remote machines? Get-CimInstance -ClassName CIM_DataFile -Filter “Name = ‘C:\\Program Files\\Internet Explorer\\iexplore.exe’”  | select -ExpandProperty Version Use the CIM_dataFile class.  Its one of the few CIM_ … Continue reading

Posted in File system, PowerShell and WMI | Leave a comment