Remotely check version of adobe reader installed - windows

I need to find out the version of adobe reader installed on 5 or six remote servers. Looking for a batch file to find out the version of adobe installed where i will provide the hostname or ip address and the script will return the version of adobe installed on that machine.

Try :
$Servers = #('Server1','Server2','Server3')
Invoke-Command -ComputerName $Servers -Sciptblock {
Get-WMIObject Win32_Product |
Where-Object {$_.Name -like 'Adobe Acrobat Reader*'} |
Select-Object Name, Version
}

Related

Display the remote computer name

This is a script to get the version of an installed software on remote computers.
Is there any way I can show the computer names in the result?
Please check the screenshot.
$pcname1 = 'TestServer1','TestServer2','TestServer3'
Get-WmiObject -Class Win32_Product -ComputerName $pcname1 |
where name -eq 'VMware Tools' |
select Name,Version
Both the obsolete Get-WmiObject cmdlet and its successor, Get-CimInstance,[1] add a .PSComputerName property to its output objects whenever the -ComputerName parameter is used.
Therefore:
$pcnames = 'TestServer1','TestServer2','TestServer3'
Get-CimInstance -Class Win32_Product -ComputerName $pcnames |
Where-Object Name -eq 'VMware Tools' |
Select-Object Name, Version, PSComputerName
[1] The CIM cmdlets (e.g., Get-CimInstance) superseded the WMI cmdlets (e.g., Get-WmiObject) in PowerShell v3 (released in September 2012). Therefore, the WMI cmdlets should be avoided, not least because PowerShell (Core) v6+, where all future effort will go, doesn't even have them anymore. Note that WMI still underlies the CIM cmdlets, however. For more information, see this answer.

How to get the full list of applications like in control panel

I have been stuck at this stage of my little project.
What I try to do is list the applications that are installed and choose one of the apps to uninstall, the issue I have is that not all the apps appear, so I can't select them. For example Google chrome is not appearing while I'm using it right now to write this question.
I use this function to get all the apps:
Get-WmiObject Win32_Product -ComputerName $ComputerName | Select-Object -Property Name | Out-GridView -Title "All apps on destination Computer"
and this is whole script:
$ComputerName = Read-Host -Prompt 'Input the computer name' # the name of the computer to remove the app from
Get-WmiObject Win32_Product -ComputerName $ComputerName | Select-Object -Property Name | Out-GridView -Title "All apps on destination Computer"
$Name = Read-Host -Prompt 'Input name of the application (has to be exact name)' #name of the application
$Application = Get-WmiObject Win32_Product -ComputerName $ComputerName | Where-Object {$_.Name -eq $Name} #choose the object, this will be the app that we will delete
if ($Application) {
$Application.Uninstall()
"The removal was successful"
}
else {
$Name + ' is not installed on ' + $ComputerName
}
Start-Sleep -Seconds 10
I'm not that good with PowerShell so excuse me if this is a stupid question
Or get-package, which should be faster. Uninstall-package only works on msi providers. Powershell 5.1 only. Metadata['uninstallstring'] has the uninstall string for Programs providers. It can take wildcards and arrays as arguments. Install-package works with msi files, but without any extra options.
get-package

Powershell - how to show which computers from a list are running a specific process?

Powershell beginner here working in an air-gapped, Win7 environment with Powershell 4.0 so unable to import any modules or do anything sophisticated but wondering how I can achieve generating a txt file of computers on the network that are running a specific process, say wusa.exe for Windows Updates?
I have a txt list of all the computer names already and so far have this:
$computers = gc "C:\PCList.txt"
foreach ($computer in $computers) {Get-process | out-file -Path "C:\TheseAreRunningWusa.txt"}
But obviously that displays ALL processes, any way to cut out everything aside from a specific one but also only list the ones running said process?
Thanks in advance.
The Get-Process command allows you to specify both a remote computer to run on, and what service you are looking for.
$computers = Get-Content "C:\PCList.txt"
$output = #()
foreach ($computer in $computers) {
if(Get-Process "myProcessName" -ComputerName $computer -ErrorAction SilentlyContinue) {
$output += $computer
}
}
$output | Set-Content "C:\TheseAreRunningMyProcess.txt"
Note: I used -ErrorAction SilentlyContinue as Get-Process throws an error if the process is not found.

Check if specific programs are installed on a remote server using powershell

I am writing a script where I need to check specific applications if installed or not on a remote server. I am fairly new to PowerShell, but here is the script I have written
ForEach ($computers in $computer){
Get-WMIObject -Class win32_product -Filter {Name like "%Microsoft%"} -ComputerName $computers -ErrorAction STOP | Select-Object -Property Name,Version | export-csv "C:\progrms.csv"
}
The problem I am facing here is I can get details of only Microsoft application which are installed and if I give multiple names for filter parameter like "Microsoft", "SQL", "app1" so on. This script does not seem to work.
Please let me know what has gone wrong and what needs to be done in order to get the list of specific software's that are installed. Also, note that I will be using this script for both Windows 2008 and 2012 servers.
Remove the -Filter {Name like "%Microsoft%"} part of the script to have it return all installed software.
You probably want to be doing ForEach ($computer in $computers) rather than the other way around, assuming you're creating a $computers variable somewhere above this code with the list of computer names.
You also need to -Append to the Export-CSV command as otherwise each computers output will overwrite the output of the previous, however another issue you'll then have is knowing which software comes from which computer. You can address this by using a Calculated Property to add in the computer name to the output, as follows:
ForEach ($Computer in $Computers){
Get-WMIObject -Class win32_product -ComputerName $Computer -ErrorAction Stop |
Select-Object -Property #{N='Computer';E={$Computer}},Name,Version |
Export-Csv "C:\progrms.csv" -Append
}

win32_printer not appear in wmiobject (Windows Power Shell)

I have an issue on a PC with Windows 7 Professional. I need to list the network printers in my local network, I tried to run the list object classes in PowerShell with the command:
Get-WMIObject -List | where {$_.name -match 'win32_printer'}
This shows empty, any suggestion to fix this problem?
EDIT:
My script for get the network printers is this:
Set-Location -Path C:\; get-WmiObject -class Win32_printer | ConvertTo-Json | Set-Content -Encoding utf8 C:\\xampp\\htdocs\\project\\view\\data\\printers.json
I need to list the printers in a json file, In my PC runs well, but in the PC where i need to run this script fail
Your command list out all WMI classes then filters those classes showing all of them that contain Win32_Printer. It seems that you want use:
Get-WMIObject Win32_Printer
This will list all printers that are connected to your computer (Not all of them that are on your network). Note that it will only show network printer connected to your user account.
If you are looking for all printers on your network you could list all of the queues published in Active Directory
Get-ADObject -Filter "ObjectCategory -eq 'printQueue'"
Note: This command requires the AD module from RSAT

Resources