Solved

PowerShell Get Windows Update Issue

Posted on 2015-01-26
2
137 Views
Last Modified: 2015-01-26
The script that I have been using has been working perfectly up until today, not sure why it is no longer properly seeing the servers.txt file. Below is the script that I have been using to get Windows Updates on a list of servers in the text file and then porting it over to a csv file. Any suggestions on the error would be greatly appreciated.

Note: If I just specify the Server Name by itself it works just fine. Not sure why the GC command stopped working.

Script:

Get-HotFix -ComputerName (gc servers.txt) |Export-Csv .\WindowsPatches.csv

Error:

Get-HotFix : Cannot validate argument on parameter 'ComputerName'. The
argument is null or empty. Supply an argument that is not null or empty and
then try the command again.
At C:\scripts\Get-WindowsServerUpdates.ps1:1 char:26
+ Get-HotFix -ComputerName (gc servers.txt) |Export-Csv .\WindowsPatches.csv
+                          ~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Get-HotFix], ParameterBindingV
   alidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power
   Shell.Commands.GetHotFixCommand
0
Comment
Question by:robertarenson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 2

Accepted Solution

by:
Marc L earned 500 total points
ID: 40571076
It looks like it is finding the server.txt file, as you are not getting a 'does not exist' error from the gc command.

Make sure there is no blank lines at the start of the servers.txt, or an illegal character. You could try copying the contents into another file.
0
 

Author Closing Comment

by:robertarenson
ID: 40571739
Thanks, not sure what happen but sure enough it was just the simple txt file that was messing things up. Thanks again
0

Featured Post

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question