Forum Discussion
how to tell how many printers are installed on the vm servers ?
Hi trsisko unknown,
there is a way you can try to use a script to see how many printers are installed on each VM server.
Here is a PowerShell script that you can use:
# Get a list of all servers
$servers = Get-VM
# Get a list of all printers on each server
foreach ($server in $servers) {
$printers = Get-Printer -ComputerName $server
# Count the number of printers
$count = $printers.Count
# Write the number of printers to a log file
Add-Content -Path "C:\PrinterCount.log" -Value "$server has $count printers installed."
}
Here’s how it works:
- It first retrieves a list of all servers using the Get-VM command.
- Then, for each server in the list, it retrieves a list of all printers installed on that server using the Get-Printer -ComputerName $server command.
- It counts the number of printers using the .Count property of the list of printers.
- Finally, it writes the number of printers installed on each server to a log file located at C:\PrinterCount.log
Please click Mark as Best Response & Like if my post helped you to solve your issue.
This will help others to find the correct solution easily. It also closes the item.
If the post was useful in other ways, please consider giving it Like.
Kindest regards,
Leon Pavesic
(LinkedIn)
- trsisko unknownNov 10, 2023Copper Contributorthx I actually realised our script distributes the creation of new printers across the servers so it's the same amount after doing a Get-printer list from several of the servers, but thanks looks good!