Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 6937

Verifying .NET usage

$
0
0

As part of a security audit, we need to:

1.  Identify versions of .NET installd.

2. Document any application which is using .NET

The guidelines provided to us for (1.) is to get the version of mscorlib.dll installed under %systemroot%\microsoft.net\Framework/Framework64.

I'm doing this using the for comand and filever.exe -

for /f "tokens=*" %a in ('dir \\host\admin$\microsoft.net\mscorlib.dll /s/b') do filever "%a".

This seems to work fine.

For #2, it's easy enough to get a list of *.exe.config (I assume there is one for every .NET executable).  What I'm trying to do from there is to document where it is set as a requirement.

Here is what I have:

get-content .\hosts.txt|

foreach-object {get-wmiobject -class win32_logicaldisk -computername $_ -filter "drivetype=3"}|
select @{name='AdminPath';expression={"\\$($_.systemname)\$($_.name -replace ':','$')"}}|
 foreach-object {get-childitem -path $_.adminpath -include *.exe.config -recurse}|
  where-object{$_.directory -notlike "*windows*"}|
  select fullname|
  select-string -pattern "requiredruntime version"

 

As you can see, I'm trying to exclude \windows\, as all that is there is the .NET installation.  For the sake of simplicity, I could remove that 'filter', which doesn't seem to work consistently anyway but it would be nice to exclude it because I get access denied errors on one section (GAC, I believe).  This process, against all drives is painfully slow.

Any ideas?

 

Thanks,

J


Viewing all articles
Browse latest Browse all 6937

Trending Articles