Git Product home page Git Product logo

eliteloser / dotnetversionlister Goto Github PK

View Code? Open in Web Editor NEW
250.0 250.0 50.0 105 KB

Use Svendsen Tech's Get-STDotNetVersion function to get a list of installed .NET Framework versions on (remote) Windows computers. I also added a simple solution for .NET 5+

Home Page: https://www.powershelladmin.com/wiki/List_installed_.NET_versions_on_remote_computers

License: MIT License

PowerShell 100.00%
dotnet dotnet-framework powershell script version

dotnetversionlister's People

Contributors

eliteloser avatar jensgj avatar jon007 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotnetversionlister's Issues

Packaging issue with 2.2.5.1 on PowerShell Gallery

There seems to be an issue with the latest release on powershellgallery.com
https://www.powershellgallery.com/packages/DotNetVersionLister/2.2.5.1

the Get-DotNetVersion is not exported by 2.2.5.1, is only exported by previous version:

Update-Module -Name DotNetVersionLister;
Get-Module;

ModuleType Version Name ExportedCommands
---------- ------- ---- ----------------
Manifest 2.2.5.1 DotNetVersionLister
Script 2.2.4 DotNetVersionLister Get-DotNetVersion

On a first time install using powershellgallery as source:

Install-Module -Name DotNetVersionLister
Get-DotNetVersion -LocalHost
Get-DotNetVersion : The term 'Get-DotNetVersion' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1

It is of course possible to download the psm1 file, import it and it works as expected:

Import-Module c:\DotNetVersionLister.psm1
Get-DotNetVersion -LocalHost

etc.. works fine.

Got an error on execution : (Win10 Enterprise) -- SOLVED

Got an error on execution : (Win10 Enterprise)

Get-STDotNetVersion -NoSummary
Get-STDotNetVersion : Command 'Get-STDotNetVersion' not found on module 'DotNetVersionLister', unable to load
module. To catch more info, run 'Import-Module DotNetVersionLister'.
In row:1 char:1

  • Get-STDotNetVersion -NoSummary
  •   + CategoryInfo          : ObjectNotFound: (Get-STDotNetVersion:String) [], CommandNotFoundException
      + FullyQualifiedErrorId : CouldNotAutoloadMatchingModule
    
    

PS C:\WINDOWS\system32> start https://go.microsoft.com/fwlink/?LinkID=135170 (to view more info)
PS C:\WINDOWS\system32> Get-ExecutionPolicy
Restricted
PS C:\WINDOWS\system32> Get-ExecutionPolicy -List

    Scope ExecutionPolicy
    ----- ---------------

MachinePolicy Undefined
UserPolicy Undefined
Process Undefined
CurrentUser Undefined
LocalMachine Undefined

TO SOLVE :
Set-ExecutionPolicy -ExecutionPolicy Unrestricted
PS C:\WINDOWS\system32> Get-STDotNetVersion
ComputerName : localhost

=4.x : 4.7.2
v4\Client : Installed
v4\Full : Installed
v3.5 : Installed
v3.0 : Installed
v2.0.50727 : Installed
v1.1.4322 : Not installed (no key)
Ping : True
Error :

Script start time: 01/20/2021 16:26:34
Script end time:   01/20/2021 16:26:34

Add pipeline input for the "ComputerName" parameter

To enable support for expressions like this:

Get-ADComputer -Filter "(OperatingSystem -like '*Windows*') -and (Enabled -eq '$true')" | Select-Object -ExpandProperty DNSHostName | Get-STDotNetVersion @otherParams

This means that not only should the "ValueFromPipeline" flag be enabled, but the data should also be appended to the output CSV file, rather than overwritten.

Make specifying -Localhost optional

Initialize the switch to true (I know it's not "best practices"), if the ComputerName array count is > 0, set it to false; the rest should magically fall into place?

Capability to distinguish .Net Framework 4.8 and .Net Framework 4.8.1

At the moment, the Get-STDotNetVersion command seems to print the same output as following no matter whether .Net Framework 4.8 or .Net Framework 4.8.1 is installed.

ComputerName : localhost
>=4.x        : 4.8 or later
v4\Client    : Installed
v4\Full      : Installed
v3.5         : Not installed (no key)
v3.0         : Not installed (no key)
v2.0.50727   : Not installed (no key)
v1.1.4322    : Not installed (no key)
Ping         : True
Error        :

    Script start time: 11/16/2022 20:31:15
    Script end time:   11/16/2022 20:31:15

Request to have the deterministic result for .Net Framework 4.8 and .Net Framework 4.8.1.

WinRM SPN Issue workaround

As described in this posting WinRM does not allow connections if the HTTP/ SPN is registered with a domain account vs computer account.
https://social.technet.microsoft.com/Forums/windows/en-US/a4c5c787-ea65-4150-8d16-2a19c569a589/enterpssession-winrm-cannot-process-the-request-kerberos-authentication-error-0x80090322?forum=winserverpowershell

You can workaround this issue with your module if you:
On the offending computer create port specific SPNs:
SetSPN.exe -s HTTP/$($env:COMPUTERNAME):5985 $env:COMPUTERNAME
SetSPN.exe -s HTTP/$($env:COMPUTERNAME).$($env:USERDNSDOMAIN):5985 $env:COMPUTERNAME

The modify your module like this (I am sure you can find a more graceful way):
~line 311
Try{
$DotNetData.$Computer = Invoke-Command @PSRSplat #-ComputerName $Computer -ScriptBlock (Get-Item function:\SetDataHashObject).ScriptBlock `
#-ArgumentList $Computer, $true -ErrorAction Stop
# -Verbose:$(if ($VerbosePreference -match 'Stop|Continue') { $true } else { $false })
}
catch {
Try{
$SessionOptions = New-PSSessionOption -IncludePortInSPN
$session = New-PSSession -Computername $computer -SessionOption $SessionOptions -Credential $Credential
$DotNetData.$Computer = Invoke-Command -Session $session -ScriptBlock (Get-Item function:\SetDataHashObject).ScriptBlock -ArgumentList $Computer, $true -ErrorAction Stop
Remove-PSSession $session
}
catch{
$DotNetData.$Computer | Add-Member -MemberType NoteProperty -Name Error -Value "PSRemoting Port failure: $_"
}
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.