Hi! I am trying to run the Invoke-Command on a few servers in various domains and subnets, and this is what I get... I need a bit of help to find out why. It works on two servers, not listed here.
The script looks like this so far, as a test in SCOM.
# Get disk alerts that are new and not handled yet
$GetNewDiskAlerts = Get-SCOMAlert -ResolutionState 0,14 | Where-Object { $_.Name -eq "Logical Disk Free Space is low"}
foreach ($Alert in $GetNewDiskAlerts)
{
Write-Host
Write-Host (("-")*100)
Write-Host "ALERT ID:" $Alert.Id
Write-Host "DESCRIPTION:" $Alert.Description
Write-Host "RESOLUTION STATE:" $Alert.ResolutionState
Write-Host "CREATED:" $Alert.TimeRaised.AddHours(2)
Write-Host "SEVERITY:" $Alert.Severity
Write-host "HOSTNAME:" $Alert.NetbiosComputerName
Write-Host "PARAMETERS:" $Alert.Parameters
# Run the commands/script on the computer with disk alerts
Invoke-Command -ComputerName ($Alert).Parameters[1] -Credential ADM\SCOM_Script_Admin -ScriptBlock {New-Item -Path C:\temp\DiskFull.txt -ItemType File -Force}
ping ($Alert).Parameters[1]
}
I have added ADM\SCOM_Script_Admin as a local administrator account on all these servers.
I can also ping all servers from the server I run the script from, except nhs45wts016 (the first one)
I've ran winrm quickconfig on all servers, which say
WinRM service is already running on this machine.
WinRM is already set up for remote management on this computer.
These are the result:
[nhs45wts016.domain] Connecting to remote server nhs45wts016.domain failed with the following error message : WinRM cannot process the request. The following error occurred while using Kerberos authentication: Cannot find the computer nhs45wts016.domain. Verify
that the computer exists on the network and that the name provided is spelled correctly. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (nhs45wts016.domain:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : NetworkPathNotFound,PSSessionStateBroken
[VSWFIL002.domain2] Connecting to remote server VSWFIL002.domain2 failed with the following error message : The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is accepting requests.
Consult the logs and documentation for the WS-Management service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to analyze and config
ure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (VSWFIL002.domain2:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : CannotConnect,PSSessionStateBroken
[SOFWEB007.domain3] Connecting to remote server SOFWEB007.domain3 failed with the following error message : WinRM cannot process the request. The following error occurred while using Kerberos authentication: Cannot find the computer SOFWEB007.domain3. Verify
that the computer exists on the network and that the name provided is spelled correctly. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (SOFWEB007.domain3:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : NetworkPathNotFound,PSSessionStateBroken
[comsql004.domain4] Connecting to remote server comsql004.domain4 failed with the following error message : WinRM cannot process the request. The following error occurred while using Kerberos authentication: Cannot find the computer comsql004.domain4. Verify
that the computer exists on the network and that the name provided is spelled correctly. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (comsql004.domain4:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : NetworkPathNotFound,PSSessionStateBroken
[VUQKOMCTX021.domain5] Connecting to remote server VUQKOMCTX021.domain5 failed with the following error message : WinRM cannot process the request. The following error occurred while using Kerberos authentication: Cannot find the computer VUQKOMCTX021.domain5.
Verify that the computer exists on the network and that the name provided is spelled correctly. For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (VUQKOMCTX021.domain5:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : NetworkPathNotFound,PSSessionStateBroken
Freddy