Solved

Powershell Script to get what.NET Versions are installed on several remote servers

Posted on 2014-10-08
5
1,886 Views
Last Modified: 2017-02-16
Powershell Script to get what .NET Versions are installed on several remote servers and exports the results to a .csv file
0
Comment
Question by:mjm21
  • 3
5 Comments
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 40368711
There you go.

$computers = Get-Content "C:\remotecomputers.txt"
foreach ($computer in $computers) {
Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse |
Get-ItemProperty -name Version -EA 0 |
Where { $_.PSChildName -match '^(?!S)\p{L}'} |
Select PSChildName, Version | Select @{Name='Computer Name';Expression={$computer}},PSChildName,Version | Export-CSV "C:\NetVersions.csv" -Append -nti
}

Open in new window

0
 

Author Comment

by:mjm21
ID: 40368868
Cool!  But getting this error:

Export-Csv : A parameter cannot be found that matches parameter name 'Append'.
At line:6 char:146
+ Select PSChildName, Version | Select @{Name='Computer Name';Expression={$computer}},PSChildName,Version | E
xport-CSV "C:\NetVersions.csv" -Append <<<<  -nti
    + CategoryInfo          : InvalidArgument: (:) [Export-Csv], ParameterBindingException
    + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.ExportCsvCommand
0
 
LVL 16

Accepted Solution

by:
Joshua Grantom earned 500 total points
ID: 40369027
try this, added a variable to store all of the results to and then output to CSV when the foreach statement is finished. Even renamed the Column to say .NET Name

$results = @()
$computers = Get-Content "C:\remotecomputers.txt"
foreach ($computer in $computers) {
$results += Get-ChildItem 'HKLM:\SOFTWARE\Microsoft\NET Framework Setup\NDP' -recurse | Get-ItemProperty -name Version -EA 0 | Where { $_.PSChildName -match '^(?!S)\p{L}'} | Select @{Name='Computer Name';Expression={$computer}},@{expression={$_.PSChildName};label='.NET Name'},Version
}
$results | Export-CSV "C:\NetVersions.csv" -nti

Open in new window

0
 
LVL 16

Expert Comment

by:Joshua Grantom
ID: 42012491
Wow that was 2 years ago, any way I can modify that Qlemo?
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Many times while working on a computer regardless of any Operating System, lag and crashes seem to creep in, hindering your working speed. Sometimes, it can also cause your work to be lost unexpectedly and as a result, you are unable to meet your de…
It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question