Keith's profileKeith Hill's BlogPhotosBlogListsMore ![]() | Help |
|
August 25 Windows PowerShell Has Moved Up to #15 on the TIOBE Programming Community IndexThe popularity of PowerShell is shooting through the roof right now. Check out this TIOBE index from August 2008. Notice the delta in position rating on PowerShell. What is that, like 10 up arrows. Impressive. August 14 Error "Cannot delete file: Cannot read from the source file or disk"I got asked this question by someone I can't seem to reply to. Anyway the scenario involves Unix, Macs and PCs writing to the same Samba server. The file attributes indicate readonly, hidden and system. The use of the -force parameter will get PowerShell to display hidden/system files. However the OP reports that Windows Explorer gets the same error. This smells like invalided characters in the path. This Microsoft KB article gives some guidance on this sort of problem in the "Invalid File Names" section. If anyone else has run into this issue specifically, feel free to post a comment on how you eventually removed the offending files. August 02 Finding Which Executables Use A DLL Entry PointRaymod Chen wrote a blog post called "Don't be helpless: ..." where he shows a batch command to start the process of finding which executables use a particular DLL entry point.
The hard work is done by link (dumpbin really) so the script provides the glue code and formatting support. I just had to give this a go in PowerShell where I knew the formatting would be superior plus I wanted to support searching on multiple entry points. Here is the script I came up with: param([string[]]$filter=$(throw "-filter parameter is required")) get-process | select ProcessName -expand Modules -ea 0 | foreach { $dll = $_ link /dump /imports $_.filename | select-string $filter | select @{n='Process';e={$dll.ProcessName}}, @{n='Dll'; e={$dll.ModuleName}}, @{n='Entry'; e={$_.Line.Substring(6)}} } | format-table Dll, Entry -groupby Process The script output looks like this:
Now that is some nice formatting made possible by the Format-Table -GroupBy parameter. |
|
|