100 days of code: Day 31

I am tracking notes on PowerShell in PS1 files on my git hub repository. You can see all 100 days of code entries on the blog category page.

As mentioned yesterday, I wasn’t sure if I would be able to really participate in very much of chapter 13 since my home network is not on a domain. But I looked it up and through some slight modifications I managed to get it work through a mere workgroup.

The other detail is that I’m going from Win 10 to Win 7 and back again, though this turned out to not be a very big deal.

So today wasn’t technically chapter 13 (day is still young) but I did do all this related to PS and enabling PS Remote Session.

Later…
Made it half way through chapter 13. Feels like I did something significant today. And mostly learned PS remote sessions in a workgroup environment at least with PS v5 isn’t that hard to setup.


Usually I would create a separate entry for this and maybe I’ll still do that later but right now I don’t think I have the patients to spin up a whole new entry so this is fine.

I ended up using this page:
https://www.paulligocki.com/how-to-setup-winrm-in-a-workgroup-non-domain-environment/

Update: After writing below I realized a few important details I didn’t know at time of writing. Please see 100 days of code: Day 32 (e.g. the next post) for corrections.

The first step on this entry to use the command

Get-NetConnectionProfile 

But this does not exist with Win 7, even with the latest version of PS 5.1. Would have been nice if the blog mentioned that but it’s fine.

The command is only used to establish if the network interface being used is set to private or public and set it to private if necessary. I can get that information through the actual network screen.

The next step is the simple command to actually enable PS Remoting:

Enable-PSRemoting

Pretty easy, right? Luckily for this command worked on both my PCs without any issues and I didn’t have to add the -force option to make it go through.

I’m going to skip a bunch of steps on the reference blog and just to the next step: winrm.cmd. I actually tried to figure this out on my own but didn’t want to spend more time on it.

Using his example:

winrm set winrm/config/client '@{TrustedHosts="10.10.10.11,11.10.10.12"}'

I modified this to point only to my Windows 7 PC from my Win 10 PC:

winrm set winrm/config/client '@{TrustedHosts="GalacticaGamer7"}'

And ran the same command from the Win 7 against the Win 10 machine.

Again very luckily this worked on both PCs under both versions of Windows.

If you’re wondering why I’m expressing so much surprise it’s because I have been through this winrm command a lot when trying to setup Hyper-V server and the matching management package under Windows 10 and this always-always-always takes me hours and hours to make my Win 10 machine connect to the Hyper-V server for management. The Win 10/Hyper-V server relationship is a bit more complex so a mere PS Remote Session is comparatively simple but winrm still manages to fill me with a sense of oh great, here we go. So to have simple commands that work on the first try is kind of a thing for me.

Maybe somebody will find this helpful, I don’t know. I’ll have to spin this off into a separate thing later.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s