Utilidad gratuita :: Lookup.NET 1.0 – en PowerShell
El otro día, publiqué una pequeña herramienta o utilidad denominada Lookup.NET 1.0 desarrollada en Microsoft .NET Framework 2.0.
Esta herramienta tiene como propósito, obtener las versiones y Service Packs de Microsoft .NET Framework instalados en las máquinas cliente.
Ante los comentarios recibidos, decidí en un primer momento publicar el código fuente de la utildiad, pero creo más sensato escribir un script en Microsoft PowerShell para realizar las mismas acciones, de forma que quede todo lo más abierto posible.
Como veréis, la comprobación solo se hace a nivel del registro de Windows, se extraen los valores y se muestran en pantalla.
A continuación se indica el script de PowerShell utilizado.
Script PowerShell (LookupDotNetVersions.ps1):
################################################################ # PowerShell Source File — Created by Jorge Serrano # NAME: LookupDotNetVersions.ps1 # PRODUCT NAME: Lookup.NET 1.0 # # AUTHOR BLOG: http://geeks.ms/blogs/jorge/ # # AUTHOR: Jorge Serrano, Visual Basic MVP # DATE : 10/12/2008 # # COMMENT: Script for get the .NET Framework version installed # in the system with their SP versions. # # KEYWORDS: PowerShell, Registry ################################################################ #Show-LookupDotNetVersions.ps1 # Path with the information of the .NET Framework versions $path= «HKLM:SoftwareMicrosoftNet Framework SetupNDP» # We write a blank line intentionally – the proposal is make it easier to read Write-Host `n # First all, we test if the regedit label exists if (-not (Test-Path $path)) { Write-Host «Some of the .NET Framework versions haven’t installed in this machine» } else { Write-Host «.NET Framework versions installed in this system» Write-Host «================================================» Write-Host «» $items = get-ChildItem $path foreach ($anotherPath in $items) { # We get the SP version of .NET Framework $valueSPVersion = Get-ItemProperty ($anotherPath.name -replace(«HKEY_LOCAL_MACHINE», «HKLM:»)) # We write the information with tab command (formatting the output) if (($anotherPath.name -replace(«HKEY_LOCAL_MACHINE\Software\Microsoft\Net Framework Setup\NDP\», «»)).Length -lt 5) { $SPinformation = «`t» + «`t» + «(SP» + $valueSPVersion.SP + «)» } else { $SPinformation = «`t» + «(SP» + $valueSPVersion.SP + «)» } # We write the information of the .NET Framework version with SP information Write-Host «.NET Framework Version:» ($anotherPath.name -replace(«HKEY_LOCAL_MACHINE\Software\Microsoft\Net Framework Setup\NDP\», «»)) $SPinformation $i++ } } # We write a blank line intentionally – the proposal is make it easier to read Write-Host `n # End of the Script |
Si lo que quires es descargarte directamente este script, puedes hacerlo en este enlace (2 Kb).
En esta entrada, lo que no voy a hacer es explicar como ejecutar y programar scripts de PowerShell ni nada por el estilo, pero podréis encontrar la información de descarga de PowerShell en este enlace.
Espero que os sirva.
5 Responsesso far
Jorge buena utilidad, sin duda ayuda demasiado
Muchas gracias Rommy. 🙂
Se agradece mucho.
Hola cesar.
El código fuente está en VB 2008.
No pensaba publicarlo, más que nada porque tampoco es creo yo cosa de otro mundo, pero si quereis no me importa publicarlo.
Un saludo,
Jorge
Muy bueno, la única pega es que sería Script for getting…:
# COMMENT: Script for get the .NET Framework version installed
# in the system with their SP versions.
¡Gracias Pepe!. 🙂