Setup PowerShell remoting
To setup a PowerShell remoting session from a Windows 10 laptop to a Windows 2008 R2 machine in an other domain, I used the following steps from:
https://4sysops.com/wiki/enable-powershell-remoting/ and added some steps for my specific situation.
(for this guide, all PowerShell consoles should be run in “Administrator” mode)
Windows 2008 R2 machine
Before I could install PowerShell 7 on a Windows 2008 R2 SP1 machine, I had to install:
WMF 4.0
I didn’t install WMF 5.1 yet, because it threw an error (may be this is fixed after WMF 4.0 installation, but I did not check yet)
Step 1 Install PowerShell
Install PowerShell 7.0.2
On installation check the box “Enable PowerShell remoting”
Step 2 Enable PowerShell remoting
On the Windows 2008 R2 machine I executed the following command inside the “out of the box PowerShell” and in the PowerShell 7 console:
Enable-PSRemoting -Force
Step 3 Enable the WinRM Service
Computer Configuration > Policies > Administrative Templates > Windows Components > Windows Remote Management (WinRM) > WinRM Service > Allow remote server management through WinRM
You have to enable this policy and set the IPv4/IPv6 filters to all (*).
Step 4 Check the Windows Remote Management Service
In the services.msc I checked it the “Windows Remote Management service” was running and startup mode was set to Automatic.
Step 5 Allow Windows Remote Management in the Firewall
Navigate to the following folder in the Group Policy Management Console (GPMC), right-click Inbound Rules, and click New Rule.
Computer Configuration > Policies > Windows Settings > Security Settings > Windows Firewall with Advanced Security
In the Predefined field, select Windows Remote Management and then follow the wizard to add the new firewall rule.
Step 6 Allow inbound remote administration exception (I believe this is only needed, when you also want to use psexec)
In the group policy management editor:
Computer Configuration > Administrative Templates > Network > Network Connections > Windows Firewall > Domain Profile.
You must enable “Allow inbound remote administration exception.”
Run gpupdate /force
Windows 10 laptop
Step 1 Install PowerShell
Install PowerShell 7.0.2
On installation check the box “Enable PowerShell remoting”
Step 2 Enable PowerShell remoting
I executed the following command inside the “out of the box PowerShell” and in the PowerShell 7 console:
Enable-PSRemoting -Force
Testing
To test the PowerShell remoting, between the Windows 10 laptop en Windows 2008 R2 SP1 server, I used:
Enter-PSSession -ComputerName 11.201.209.42 -Credential MyOtherDomain\SomeDomainAdminAccount
You can use an IP address, instead of a computer name, when using PowerShell remoting
If you want to connect to a remote server by using PowerShell remoting
Enter-PSSession -ComputerName 11.201.209.42 -Credential MyOtherDomain\SomeDomainAdminAccount
How to automatically add unstaged files including new files to a git commit
The git commit commando does not allow you to automatically stage new files and add them to the commit.
If you want to automatically stage files that have been modified and deleted or should be added, before you commit, then you should use 2 commands:
git add . ;git commit -a
Just make sure your .gitignore file is up to date.
How to squash commits rewriting the commit message
You can use