i am trying to restart a server with an ip but it fails with the messege:
Restart-Computer :
Failed to restart the computer *.*.*.* with the following error message: The RPC server is unavailable.
At line:1 char:1
+ Restart-Computer -ComputerName *.*.*.* -Credential $Creds -Fo ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (*.*.*.*:String) [Restart-Computer], InvalidOperationException
+ FullyQualifiedErrorId : RestartcomputerFailed,Microsoft.PowerShell.Commands.RestartComputerCommand
i have changed that computer's RDP port, how do i specify the port in this command? i can't find it in the documentations or the examples over the internet.
any help will be appreciated...
Related
I'm trying to remote into a password protected server using powershell, but it keeps throwing errors.
My code:
winrm set winrm/config/client #{TrustedHosts="XX.X.XXX.XX"}
$cred = Get-Credential
New-PSSession XX.X.XXX.XX -Credential $cred
and the output:
PS C:\Users\user.name> winrm set winrm/config/client #{TrustedHosts="XX.X.XXX.XX"}
$cred = Get-Credential
New-PSSession XX.X.XXX.XX -Credential $cred
winrm : Error: Invalid use of command line. Type "winrm -?" for help.
At line:1 char:1
+ winrm set winrm/config/client #{TrustedHosts="XX.X.XXX.XX"}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Error: Invalid ...m -?" for help.:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
cmdlet Get-Credential at command pipeline position 1
Supply values for the following parameters:
New-PSSession : [XX.X.XXX.XX] Connecting to remote server XX.X.XXX.XX failed with the following error message : The WinRM client cannot process the request. Default authentication may be
used with an IP address under the following conditions: the transport is HTTPS or the destination is in the TrustedHosts list, and explicit credentials are provided. Use winrm.cmd to
configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated. For more information on how to set TrustedHosts run the following command: winrm help
config. For more information, see the about_Remote_Troubleshooting Help topic.
At line:3 char:1
+ New-PSSession XX.X.XXX.XX-Credential $cred
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CannotUseIPAddress,PSSessionOpenFailed
My IP address is in the format XX.X.XXX.XX, but I censored it because I have no idea how secure/insecure it is to put that on the internet.
This question already has answers here:
Stopping & Restarting Services Remotely Using Set-Service
(3 answers)
Closed 3 years ago.
I need to restart services of a LAN Computer using IP Address. I have this researched:
Restart-Service -ComputerName \\10.10.11.16 -ServiceName IETCQRService dnsCache
and this is the error I get:
Restart-Service : A parameter cannot be found that matches parameter name
'ComputerName'.
At line:1 char:17
+ Restart-Service -ComputerName \\10.10.11.16 -ServiceName IETCQRServic ...
+ ~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Restart-Service], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.RestartServiceCommand
I need to use the IP Address because the computer names are the same, they just differ on the IP Address.
EDIT
I have used the suggestion but I get this error now:
PS C:\WINDOWS\system32> Get-Service -ComputerName 10.10.11.16 -Name "IETCQRService" | Restart-Service
Get-Service : Cannot find any service with service name 'IETCQRService'.
At line:1 char:1
+ Get-Service -ComputerName 10.10.11.16 -Name "IETCQRService" | Restart ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (IETCQRService:String) [Get-Service], ServiceCommandException
+ FullyQualifiedErrorId : NoServiceFoundForGivenName,Microsoft.PowerShell.Commands.GetServiceCommand
So far as I know, there is no -ComputerName parameter on the Restart-Service command. Instead, you could use something like this:
Get-Service -ComputerName 10.10.11.16 -Name "IETCQRService" | Restart-Service
You could use both the IP address or the computer name in the Get-Service command
Note As pointed out in the comments, this option isn't viable going forward as it is being removed from PowerShell version 6+.
Error:
Enter-PSSession : Connecting to remote server sadcm0000081 failed with the following error message : WinRM cannot
complete the operation. Verify that the specified computer name is valid, that the computer is accessible over the
network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. By
default, the WinRM firewall exception for public profiles limits access to remote computers within the same local
subnet. For more information, see the about_Remote_Troubleshooting Help topic.
At line:1 char:1
+ Enter-PSSession -ComputerName sadcm0000081
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (sadcm0000081:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
Test-WSN Output:
Test-Wsman : <f:WSManFault xmlns:f="http://schemas.microsoft.com/wbem/wsman/1/wsmanfault" Code="2150859046" Machine="SADCM0000078.adc
.corpintra.net"><f:Message>WinRM cannot complete the operation. Verify that the specified computer name is valid, that the computer i
s accessible over the network, and that a firewall exception for the WinRM service is enabled and allows access from this computer. B
y default, the WinRM firewall exception for public profiles limits access to remote computers within the same local subnet. </f:Messa
ge></f:WSManFault>
At line:1 char:1
+ Test-Wsman -ComputerName sadcm0000081
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidOperation: (sadcm0000081:String) [Test-WSMan], InvalidOperationException
+ FullyQualifiedErrorId : WsManError,Microsoft.WSMan.Management.TestWSManCommand
Try first to running powershell Enable-PSRemoting with an administrator console.
After that look after the Windows Firewall rules of remote administration.
I am unable to get around the following Powershell remoting error in my Windows 10 Machine.
Firstly I am attempting to execute the following.
PS: >Start-DscConfiguration -Wait -Verbose -Force -Path $outPath
VERBOSE: Perform operation 'Invoke CimMethod' with following parameters, ''methodName' = SendConfigurationApply,'className' = MSFT_DSCLocalConf
igurationManager,'namespaceName' = root/Microsoft/Windows/DesiredStateConfiguration'.
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".
+ CategoryInfo : ConnectionError: (root/Microsoft/...gurationManager:String) [], CimException
+ FullyQualifiedErrorId : HRESULT 0x80338012
+ PSComputerName : localhost
so I do what it suggests by executing this.
PS: >winrm quickconfig
WinRM service is already running on this machine.
winrm : WSManFault
At line:1 char:1
+ winrm quickconfig
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (WSManFault:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Message
ProviderFault
WSManFault
Message = More data is available.
Error number: -2147024662 0x800700EA
More data is available.
Thanks for the help
I am trying to open remote PSSession from one PC to another. Both PCs are in the LAN and reachable, but whenever I try to enter PSSession the following error occurs:
Enter-PSSession : Connecting to remote server pc2 failed with the
following error message : The WinRM client cannot process the request.
Unencrypted traffic is currently disabled in the client configuration.
Change the client configuration and try the request again. For more
information, see the about_Remote_Troubleshooting Help topic. At
line:1 char:1
+ Enter-PSSession -ComputerName pc2 -Authentication Basic -Credential admin
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (pc2:String) [Enter-PSSession], PSRemotingTransportException
+ FullyQualifiedErrorId : CreateRemoteRunspaceFailed
I have set AllowUnencrypted to true in both
WSMan::localhost\Client
and
WSMan::localhost\Service
location on the remote PC, but still getting the same error. Are there other settings I need to update?