With PowerShell 5 we were given the possibility to create more "real" custom classes.
I have some notes, trials and personal examples in SQLAdmin Github (link).
SQL Server administration, infrastructure, automation, instrumentation etc.
With PowerShell 5 we were given the possibility to create more "real" custom classes.
I have some notes, trials and personal examples in SQLAdmin Github (link).
Some situations still require a short name like a 8.3 name of a file. This will often be on not only the name of the object but on the entire path. Back in the days of the Windows Shell we would use the command dir /x
.
I have looked into getting the short name in a PowerShell script to make it available in a more complex script.
Unfortunately .NET does not have such a method to a FileInfo
or DirectoryInfo
object. So I have used the Win32 function GetShortPathName()
.
The script is in SQLAdmin Github (link) with some technical notes in the associated markdown file.