how get a group of computer's average memory ultilization and average cpu ultilization, average page out per second and peak disk ultilization and operating system name

not all computers in active directory, can i use DNS host instead of active directory to do the request

when using active directory, i got error, where can find the group name of computers?

PS C:\Users\Administrator\Downloads> .\RunCommand.ps1 FileServicesGroup "systemi
nfo | findstr /C:""Total Physical Memory"""
The term 'Get-ADGroupMember' is not recognized as the name of a cmdlet, functio
n, script file, or operable program. Check the spelling of the name, or if a pa
th was included, verify that the path is correct and try again.
At C:\Users\Administrator\Downloads\RunCommand.ps1:11 char:36
+ $ADGroupMembers = Get-ADGroupMember <<<<  -Identity $ADGroupName
    + CategoryInfo          : ObjectNotFound: (Get-ADGroupMember:String) [], C
   ommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

Invoke-Command : Cannot validate argument on parameter 'ComputerName'. The argu
ment is null or empty. Supply an argument that is not null or empty and then tr
y the command again.
At C:\Users\Administrator\Downloads\RunCommand.ps1:15 char:33
+     Invoke-Command -ComputerName <<<<  $computer.name -ScriptBlock $ScriptBlo
ckContent -ArgumentList $CommandToRun
    + CategoryInfo          : InvalidData: (:) [Invoke-Command], ParameterBind
   ingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Power
   Shell.Commands.InvokeCommandCommand

[CmdletBinding()]
Param(
    [Parameter(Mandatory=$true, Position=1)][string]$ADGroupName,
    [Parameter(Mandatory=$true, Position=2)][string]$CommandToRun
)

$ScriptBlockContent = { 
    param ($CommandToRun)
    Invoke-Expression $CommandToRun }

$ADGroupMembers = Get-ADGroupMember -Identity $ADGroupName
foreach ($computer in $ADGroupMembers)
{
    #Run the required command on each computer in the group
    Invoke-Command -ComputerName $computer.name -ScriptBlock $ScriptBlockContent -ArgumentList $CommandToRun
}
May 25th, 2015 3:27am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics