17
I'm screwing something up, I just don't know what
Post Body
I found this great bit of code online that generates uptime and disk space for all computers on your domain. The problem is it's slow....VERY slow, like over 24 hours slow. So I decided instead of forcing the script to Get-ADComputer, I would just dump all computers into a text file and have it read that. And that's when the trouble begins. Here's the error:
Test-Connection : Cannot validate argument on parameter 'ComputerName'. The
argument is null or empty. Provide an argument that is not null or empty, and
then try the command again.
At C:\Scripts\QueryAD_HTML_Uptime_FreespaceReport.ps1:68 char:28
if(Test-Connection -cn $s -Quiet -BufferSize 16 -Count 1)
~~
CategoryInfo : InvalidData: (:) [Test-Connection], ParameterBindingValidationException
FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power
Shell.Commands.TestConnectionCommand
Here's the relevant bit of code:
$servers = Get-Content "C:\Scripts\Computers.txt"
Function Get-UpTime
{ Param ([string[]]$servers)
$computers = @()
Foreach ($s in $servers)
{
if(Test-Connection -cn $s -Quiet -BufferSize 16 -Count 1)
Author
Account Strength
100%
Account Age
12 years
Verified Email
Yes
Verified Flair
Yes
Total Karma
66,614
Link Karma
30,920
Comment Karma
35,639
Profile updated: 3 days ago
Posts updated: 9 months ago
Subreddit
Post Details
We try to extract some basic information from the post title. This is not
always successful or accurate, please use your best judgement and compare
these values to the post title and body for confirmation.
- Posted
- 8 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/PowerShell/...