Converting the FileSystemObject's GetExtensionName Method
Definition: Given a file name or full path, returns the file extension of the file (without the .).
In PowerShell, you can use the Get-Item cmdlet to retrieve a reference to the file, then check the Extension property:
$a = Get-Item c:\scripts\test.txt $a.extension
You can also do this in one line:
Note that, unlike GetExtensionName, the Extension property includes the dot in the name. In other words, the preceding command will return .txt, not simply txt.