WinRM Dienst startet nicht mit Fehlercode 234 im System Eventlog

Posted by O.Sommer

Der Windows Remote Management Service (WinRm) Dienst startet heute auf zwei VMs mit der Fehlermeldung 234 im Eventlog nicht:

Log Name:      System
Source:        Microsoft-Windows-WinRM
Date:          21.02.2014 14:34:27
Event ID:      10119
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      serverxyz.servers.someone
Description:
The WinRM service is unable to start because of a failure during initialization.

Additional Data
The error code is 234.

Der WinRm Dienst ließ sich auch durch

WinRm quickconfig

in einer administrativen CMD nicht konfigurieren/einstellen/starten:

F:\>winrm quickconfig
WinRM is not set up to receive requests on this machine.
The following changes must be made:

Set the WinRM service type to delayed auto start.
Start the WinRM service.

Make these changes [y/n]? y

WinRM has been updated to receive requests.

WinRM service type changed successfully.
WinRM service started.
WSManFault
    Message = The client cannot connect to the destination specified in the request. Verify that the service on the destination is running and is ccepting 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 configure the WinRM service: "winrm quickconfig".

Error number:  -2144108526 0x80338012
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 configure the WinRM service: "winrm quickconfig".

F:\>winrm enumerate winrm/config/listener
WSManFault
    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 configure the WinRM service: "winrm quickconfig".

Error number:  -2144108526 0x80338012
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 configure the WinRM service: "winrm quickconfig".

 

Nach kurzer Recherche fand ich folgendes Posting in den MS Foren:

http://social.technet.microsoft.com/Forums/windowsserver/en-US/01773ae7-6209-477b-ab30-705090be9b1d/the-winrm-service-is-unable-to-start-because-of-a-failure-during-initialization?forum=winserverManagement

Dort wird beschrieben das im Registrierungsschlüssel:

HKLM\SYSTEM\CurrentControlSet\Services\HTTP\Parameters

Einträge mit falschem Type, wären. REG_SZ und REG_QWORD statt REG_DWORD.
Das war auch bei den beiden VM die ich hatte so, dort waren es die beiden REG_SZ Einträge, die in folgendem Screenshot schon als REG_DWORD von mir neu angelegt wurden und die alten, für späteres Troubleshooting (falls nötig) umbenannt wurden:

image

Nachdem die beiden Werte als REG_DWORD neu erstellt wurdn, ließ sich der WinRM Dienst mittels “winrm quickconfig” dann auch erfolgreich konfigurieren und starten:

image

 

How to use Powershell to remotely disable a networkadapter on an array of computers

Posted by O.Sommer

Today I had the challenge to disable a specifically named NIC on a larger number of Hyper-V hosts, because that card was causing issues with the cluster compatibility check when joining those Nodes to a Windows Hyper-V Cluster.
I found that disabling 64 Networkadapters on 64 Servers would take a while if you use RDP to remote into each server, so I wrote this little script to automate this using Remote Powershell, which is enabled by default if those computers are Part of a domain, or I enabled it during the deployment phase, which I can not remember right now:

# ask for Admin password
$cred = Get-Credential -Credential hypercluster\Administrator
# run through all i nodes and disable USB NIC
for ($i = 1;$i -le 64;$i++){
Echo Node$i
Enter-PSSession -ComputerName Node$i -Credential $cred
$usbnic = Get-WmiObject win32_networkadapter | where {$_.name -eq "IBM USB Remote NDIS Network Device"}
$usbnic.disable()
}
# exit remote Powershell
exit


EDIT:
This is an optimized version of the upper script and I also added a line that disables all disconnected networkcards:

# ask for Admin password
$cred = Get-Credential -Credential hypercluster\Administrator
# run through all i nodes and disable USB NIC
for ($i = 1;$i -le 64;$i++){
Echo Node$i
Enter-PSSession -ComputerName Node$i -Credential $cred
(Get-WmiObject win32_networkadapter -ComputerName Node$i | where {$_.name -eq "IBM USB Remote NDIS Network Device"}).Disable()
# use the following lien to disable all disconnected (unpluged networkcable) NICs
# (Get-WmiObject win32_networkadapter -ComputerName Node$i -Filter 'NetConnectionStatus= 7').Disable()

 

Edit2:
To shutdown an array of servers via Powershell i used this version of the script:

# ask for Admin password
$cred = Get-Credential -Credential hypercluster\Administrator
# run through all i nodes and shutdown each one
for ($i = 1;$i -le 64;$i++){
Echo Node$i
stop-Computer –ComputerName node$i –Credential $cred –force