Skip to content

Comments

Fix Restart-Computer to work on localhost when WinRM is not present#9160

Merged
adityapatwardhan merged 6 commits intoPowerShell:masterfrom
adityapatwardhan:FixRestartComputer
Mar 19, 2019
Merged

Fix Restart-Computer to work on localhost when WinRM is not present#9160
adityapatwardhan merged 6 commits intoPowerShell:masterfrom
adityapatwardhan:FixRestartComputer

Conversation

@adityapatwardhan
Copy link
Member

@adityapatwardhan adityapatwardhan commented Mar 18, 2019

Fixes #8197

PR Summary

PowerShell core uses WSMan transport for all operation. When winRM is not present creating a session fails. The PR uses the default transport when the target computer is localhost. We get the instance on Win32_ComputerSystem and then call the instance method on it to restart the computer.

The PR also fixes Rename-Computer similarly.

PR Context

On winPE arm64, winRM is not present and hence Restart-Computer fails.

PR Checklist

@adityapatwardhan
Copy link
Member Author

The change has been manually tested on winPE arm64 machine.

@adityapatwardhan
Copy link
Member Author

@SteveL-MSFT Please re-review, comments addressed. Rename-Computer change reverted as it is not required.

@adityapatwardhan adityapatwardhan changed the title Fix Restart-Computer and Rename-Computer to work on localhost when WinRM is not present Fix Restart-Computer to work on localhost when WinRM is not present Mar 19, 2019
Copy link
Collaborator

@iSazonov iSazonov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How would we test this in CIs?

@iSazonov iSazonov added the CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log label Mar 19, 2019
iSazonov and others added 2 commits March 19, 2019 09:48
@adityapatwardhan
Copy link
Member Author

@iSazonov - We cannot test this in CI. This specifically repro on special hardware which is not available in CI system. I have tested it manually.

@adityapatwardhan adityapatwardhan merged commit 0fe9af4 into PowerShell:master Mar 19, 2019
@adityapatwardhan adityapatwardhan deleted the FixRestartComputer branch March 19, 2019 21:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-General Indicates that a PR should be marked as a general cmdlet change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restart-Computer does not function on arm64

3 participants