Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <#
  2. .SYNOPSIS
  3.     Determina si un software esta instalado en una estacion
  4.  
  5. .DESCRIPTION
  6.     Dado el UNC de la estacion y el nombre del software
  7.     (puede ser parcial) busca si este software esta instalado
  8.  
  9. .PARAMETER help
  10.     Despliega el full help
  11.  
  12. .PARAMETER compname
  13.     Nombre del ordenador a conectarse, si no se da, se asume el local
  14.    
  15. .PARAMETER softname
  16.     Nombre del software a probar
  17. #>
  18. function Get-Installed{
  19.  
  20.     Param(
  21.     [switch] $help,
  22.     [string] $compname,
  23.     [string] $softname
  24.     )
  25.  
  26.     Process{
  27.     if($help){
  28.         get-help Get-Installed -full
  29.     }
  30.    
  31.     if(!$compname){
  32.         $compname = "localhost"
  33.     }
  34.    
  35.     if(!$softname){
  36.         return ;
  37.     }
  38.    
  39.        Get-WmiObject -ComputerName $compname -Class Win32_product | Where-Object -FilterScript{ $_.Name -like (-join "*", $softname, "*") }
  40.        
  41.     }
  42.  
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement