Hi everyone, I wanted to share a quick story. One day, I found myself needing to check the installed printers and their IP addresses on a customer’s computer, but I didn’t want to interrupt them with a bunch of questions or cause any disruptions to their workflow. I knew there had to be a better way to get the information I needed without being intrusive. That’s when it hit me – why not create a script that could do the job for me? With a little help from PowerShell and SimpleHelp, I put together a script that could pull up all the printers installed on a machine, along with their ports and IP addresses, so I could see exactly what was there. Now, I could quickly check a customer’s setup without bothering them. Let me show you how I did it. Step 1: Writing the PowerShell Script PowerShell has some handy cmdlets like Get-Printer and Get-PrinterPort that make accessing printer and port details really straightforward. Here’s the script I came up with to retrieve this information quickly and easily. PowerShell Script to List Installed Printers and Ports Get all installed printers $printers = Get-Printer Loop through each printer and get the port information # Get all installed printers $printers = Get-Printer # Loop through each printer and get the port information foreach ($printer in $printers) { $printerName = $printer.Name $printerPort = $printer.PortName # Get details of the printer port $portDetails = Get-PrinterPort -Name $printerPort # Display printer and port information Write-Host “Printer: $printerName” Write-Host “Port Name: $printerPort” # Display the IP address if it exists (for network ports) if ($portDetails.PrinterHostAddress) { Write-Host “IP Address: $($portDetails.PrinterHostAddress)” } else { Write-Host “No IP Address (Local Printer or other type of port)” } Write-Host “—————————————-“ } How It Works: 1. Get-Printer: This command pulls up all the printers installed on a system. 2. Loop through each printer: For each printer, we grab the associated port. 3. Get-PrinterPort: The port details command fetches the IP address if it’s a network printer. 4. Output Information: It displays the printer name, port name, and IP address if available. Local printers will just show “No IP Address.” This script is perfect for those times when you need to check printers but don’t want to intrude. Step 2: Running the Script with SimpleHelp The next step was figuring out how to run this remotely. That’s where SimpleHelp comes in. It lets me set up tools I can run directly on a customer’s machine. Here’s how I set it up: 1. Save the Script: First, I saved the script as List-Printers.ps1. 2. Upload to SimpleHelp: In SimpleHelp’s Tools section, I uploaded the script to create a new tool. 3. Run Remotely: Now, whenever I need to check a customer’s printer setup, I just select the machine in SimpleHelp and run the tool. SimpleHelp executes the script on their end and sends back the results. What the Output Looks Like When I run this, I get a clean, simple output like this: Printer: HP LaserJet Pro MFP Port Name: IP_192.168.1.45 IP Address: 192.168.1.45 —————————————- Printer: Microsoft Print to PDF Port Name: PORTPROMPT: No IP Address (Local Printer or other type of port) —————————————- This tells me exactly what I need to know – which printers are installed, the port they’re using, and the IP address if they’re network printers. Why This Script Made My Life Easier The best part? I can gather all this information without ever disturbing the user. It’s fast, accurate, and saves me the time of asking back-and-forth questions or logging into the machine manually to check. Now, when I get a printer-related question, I have all the answers I need in just a few clicks. If you ever need to check printer details on a remote machine, give this script a try! It’s been a real time-saver for me, and I hope it can be for you, too. Let me know if you try it out – or if you have other script ideas that make remote support easier!
Automated Backup Reports
Donate a Coffee If you found the information helpful, please consider supporting us by donating a coffee to help keep this website alive. Your contribution is greatly appreciated! Automated Backup Reports for Windows Machines: A Comprehensive Guide Part I Computer Setup In today’s data-driven world, maintaining robust backup systems is essential to safeguarding critical information. Automating backup reports for Windows machines not only ensures data integrity but also provides clients with transparency and peace of mind. In this guide, I’ll walk you through the setup process step by step, highlighting the tools and techniques involved. The core concept of this project revolves around enhancing the backup reporting service provided by the company I’m associated with. While our company already sends out email notifications to users, primarily managers, upon the completion or encountering issues during backup processes, we’ve identified an opportunity to offer additional insight and transparency. To address this, we’ve begun sending out comprehensive spreadsheets to select clients. These spreadsheets detail each machine and server, providing crucial information such as the date of the last backup, the contents included in the backup, and the scheduled time for the next backup session. This initiative aims to empower clients with a clear understanding of their backup status, fostering trust and reliability in our services. What you need Windows Backup: Utilizing the built-in Windows backup functionality. Task Manager: Orchestrating tasks based on event triggers. Email Services: Leveraging Gmail and Outlook for email notifications. Power Automate: Automating tasks and processes. Excel: Organizing and visualizing backup reports. Scripting (PowerShell): Automating actions based on event triggers. In configuring our computer/server setup (windows server 2012 R2 in our scenario), the initial step involves enabling/setting up Windows Backup. Once this foundational setup is complete, our focus shifts to creating a script tailored to send event information to Outlook. Script Code Function Send-Email($Subject, $Body) {$SMTPServer = “insert smtp server here”$SMTPPort = “587”$From = “insert here the gmail account or the account which is used to send emails from”$To = “email where you send to”$Username = “username you are using to send email” $SecurePassword = Get-Content C:Scriptssecurepassword.txt | ConvertTo-SecureString$Credential = New-Object System.Management.Automation.PSCredential ($Username, $SecurePassword) Send-MailMessage -From $From -To $To -Subject $Subject -Body $Body -SmtpServer $SMTPServer -Port $SMTPPort -Credential $Credential -UseSsl} try {$event = Get-WinEvent -FilterHashtable @{LogName=’Microsoft-Windows-Backup’; ProviderName=’Microsoft-Windows-Backup’} -MaxEvents 2Write-Host “Fetched event with ID $($event.Id)”}catch {Write-Host “An error occurred while fetching the Microsoft-Windows-Backup event.”Send-Email “Server – Error Fetching Backup Event” “An error occurred while fetching the Microsoft-Windows-Backup event.”exit 1} $successfulEventId = 4$failedEventId = 5 if ($event.Id -eq $successfulEventId) {Send-Email “Server – Windows Server Backup Is Successful” “$($event.Message)”} elseif ($event.Id -eq $failedEventId) {Send-Email “Server – Windows Server Backup – FAILED” “$($event.Message)”} else {Send-Email “Server – Unknown Backup Event” “$($event.Message)”} Please copy the provided code and save it with a name of your choice, ensuring it bears the .ps1 extension. For instance, I’ve chosen to save the script as “backupnotif.ps1” in the directory C:Scripts. Additionally, execute the following script to generate a secure password for your Google email account or whichever account you use to dispatch emails to the Outlook account. Feel free to customize the code according to your preferences. In this particular scenario, the script will prompt you to input the password, which will then be encrypted and saved in encoded format within C:Scriptssecurepassword.txt. It’s important to note that the securepassword.txt file is tied to one computer due to its reliance on the Read-Host argument. If you intend to utilize it on another computer, you must rerun the script on that specific machine. This method ensures the confidentiality and security of your email credentials while streamlining the setup process for enhanced functionality. Secure Password Powershell Command Read-Host -Prompt “Enter your password” -AsSecureString | ConvertFrom-SecureString | Out-File -FilePath “C:Scriptssecuredpassword.txt” In finalizing the setup for our computer/server, the pivotal last steps involve configuring two tasks within the Task Scheduler. The initial task we establish is designed to address backup failures effectively. Firstly, under the General tab, it’s imperative to ensure that the task runs irrespective of whether a user is logged in and to enable the “Run with highest privileges” option for enhanced functionality. Transitioning to the Triggers tab, click on “New” to initiate a new trigger based on a specific event. In this case, for Windows Server 2012 R2, the event to trigger the task is identified by the Log: Microsoft-Windows-Backup/Operational and ID: 4. For further insights on how to locate event IDs specific to your Windows version, I encourage you to access this link which offers detailed guidance on event ID identification based on Windows versions. To configure the task for successful backups, we’ll need to create a custom XML query. Begin by creating a new task and assigning it a name of your choice, such as “Successful Backup.” Maintain the same settings under the Actions tab as in the previous task. The key difference lies in the Trigger tab. Here, select “Custom” and proceed to “Edit Event Filter.” Check the “Edit XML” tab and select “Edit query manually” to view and adjust the XML query as needed. The provided query ensures that the task triggers upon successful backup events. Feel free to modify the query to align with your specific requirements, tailoring it to capture the events relevant to your system’s backup success criteria. XML Query for Successful backup trigger <QueryList><Query Id=”0″ Path=”Microsoft-Windows-Backup”><Select Path=”Microsoft-Windows-Backup”>*[System[(EventID=5 or EventID=8 or EventID=9 or (EventID >= 17 and EventID <= 22) or EventID=49 or EventID=50 or EventID=52 or EventID=100 or EventID=517 or EventID=518 or EventID=521 or EventID=527 or EventID=528 or EventID=544 or EventID=545 or EventID=546 or EventID=561 or EventID=564 or EventID=612)]]</Select></Query></QueryList> Part II Cloud Setup In the final phase of our setup, we focus on configuring rules within Power Automate to automate the entire process seamlessly. Navigate to https://make.powerautomate.com/ and either log in or sign up if you haven’t already. On the left-hand side, select “Create” and then choose “Automated cloud flow.” Assign a meaningful name to the flow, such as “Client Name – Machine Name” (e.g., Apple – DC-server). Utilize the search bar to