Manage Active Directory Users And Computers Using Windows 10 In PowerShell Direct Without CredSSP Or “Second-Hop” Issues

#Manage Active Directory Users And Computers Using Windows 10 in PowerShell Direct Without CredSSP Or “Second-Hop” Issues

#When connecting to a virtual machine using PowerShell Remoting, enabling CredSSP (Credential Security Support Provider) is essential to avoid “Second-Hop” or “Multi-Hop” issues when managing Active Directory objects. CredSSP is particularly necessary when connecting to physical machines, as PowerShell Direct only functions when connecting directly from the host computer to a virtual machine.

#PowerShell Direct does not encounter the “Second-Hop” problem when managing Windows Server 2016 from a Windows 10 virtual machine running Hyper-V. Since I have enabled the Hyper-V role on my Windows 10 Professional system and my physical machine is not part of a domain, the Windows 10 virtual machine must be joined to the Active Directory domain that I intend to manage. This setup avoids additional configuration changes related to workgroup settings.


#The Longer Story…

#Create a new Organizational Unit in PowerShell Remote using just the computer name

#Without CredSSP enabled this command fails in PowerShell Remote which is initiated by using-ComputerName with Enter-PSSession

#Create a new Organizational Unit in PowerShell Direct using just the virtual machine name

#Just using OU=Test as an example to show how this command doesn’t fail in PowerShell Direct using -VMName like it did in the previous example using -ComputerName.

#Set –ProtectedFromAccidentalDeletion to $false on OU=Test so it can be deleted

#This needs to be done to allow the OU to be deleted.

#Delete OU=Test from -Server KERMIT.

#KERMIT is the NetBIOS computer name of my domain controller and not the domain NetBIOS name. They are different things.

 

Join Windows 10 Professional To An Active Directory Domain Using PowerShell Direct

#Join Windows 10 Professional To An Active Directory Domain Using PowerShell Direct

#These are the commands to rename a Windows 10 client computer to GONZO and add that computer to a domain called domain.winrollup.int


#The Longer Story…

#Your computer may not need to be renamed so skip that if needed. Also the Add-Computer command sends your newly added computers to the Computers container by default unless you specify an -OUPath when running Add-Computer.

#Rename computer before joining your domain if your computer name doesn’t comply with server standards. Restart required.

#Join a domain called domain.winrollup.int. Restart required.

#You need to change the -DomainName from domain.win1rollup.int to what you call your domain. Use -Restart at the end of the Add-Computer command to automatically restart.


#A Bit More

#Specify a preconfigured Organizational Unit path when joining domain

#My domain is simple and this is not needed for me at this time. I don’t have multiple Organizational Units yet and I don’t need any Group Policies affecting this PC since I’m working with my Windows 10 management PC. I’m able to specify the -OUPath shown below, once I complete the step below to create an OU called ServerAdmins. This command adds the computer to OU=ServerAdmins.

#You are not able to specify another container besides the default Computers container, but there is a way to change the default container if you don’t specify an OU. I definitely don’t want my computers added to the default OU which is OU=Domain Controllers, so I don’t use this command switch unless I have created a new OU first. It has been suggested to create the OU and computer object prior to joining the domain, but I don’t need to do that at this point.

#The command below is used to specify an Organizational Unit when joining a domain, if needed.

#Create a new Organizational Unit on the server (Needs to be run on Windows Server 2019 with the Active Directory role installed and configured)

#If you preconfigure an alternative Organizational Unit on Windows Server 2019 then you can add your computers directly to that OU by specifying a -OUPath when running Add-Computer.

Enable or Disable Game Mode In Windows 10 Creators Edition Using PowerShell Commands

#Enable Game Mode In Windows 10 Creators Edition Using PowerShell Commands

#Enable Game Mode in Windows 10 Creators Edition only. This does not work in previous or the latest version of Windows 10.  Windows Key + G will toggle Game Mode once the changes have been made. This command appears to have no effect in 1909.

#Just the command


#The Longer Story…

#The above command enables Game Mode. The command below disables Game Mode. Again this feature is only available in Windows 10 Creators Edition. These commands work in both PowerShell and PowerShell Direct.

#Check Game Bar Registry Key And Existing Configuration (1=Enabled, 0=Disabled)

#If the GameBar registry key has no properties then Game Mode is disabled.  If allow AllowAutoGameMode is set to 1 then Game Mode is enabled. If it is set to 0 then AllowAutoGameMode is disabled.

#▲Game Mode Disabled (Installation Default)

#▲Game Mode Enabled

#Enable Game Mode In Windows 10 For The First Time

#The -Force switch is used to a skip using New-Item or New-ItemProperty commands but specifying -Force will delete the key and recreate the key and you will lose all sub-keys.

#Disable Game Mode In Windows 10 Once Enabled Or To Manually Set Game Mode To Disabled

#If you just remove the registry key then Game Mode will stay enabled. Changing AllowAutoGameMode to 0 will disable Game Mode once it has been enabled.

#Check If AllowAutoGameMode Registry Property Is Enabled (1=Enabled, 0=Disabled)

#Is similar to the other command to check Game Mode status with more information about the registry key. This command will error if AllowAutoGameMode is not there but just means that Game Mode is disabled by default.


#Keyboard Shortcuts for Game Barhttps://support.microsoft.com/en-us/instantanswers/a4cced71-b833-4e48-8523-8be8b7d29448/keyboard-shortcuts-for-game-bar

#Additional Microsoft Game Infohttps://www.microsoft.com/en-us/windows/windows-10-games

Enable Hyper-V Role In Windows 10 Professional, Enterprise And Education Vs. Android Emulators

#Enable The Hyper-V Role in Windows 10 Professional, Enterprise Or Education Using PowerShell

#If this is the first time, and if if this will be the only time enabling the Hyper-V role in Windows 10, then this PowerShell command is all you need. If you need to switch the Hyper-V services on/off to avoid interference with other hypervisors and without removing the Hyper-V role then download Hyper-V Switch.

#Enable Hyper-V Role Using PowerShell

#Disable Hyper-V Role Using PowerShell


#The Long Story…

#Continue reading if you are having issues or are using a conflicting hypervisor or emulator and getting the dreaded Blue Screen of Death.

#Having Issues Enabling Hyper-V Role In Windows 10 Professional, Enterprise Or Education?

Check Requirements

  • Windows 10 Enterprise, Professional, or Education
  • 64-bit Processor with Second Level Address Translation (SLAT)
  • CPU support for VM Monitor Mode Extension (VT-c on Intel CPU’s)
  • Minimum of 4 GB memory

NOTE: The Hyper-V role cannot be installed on Windows 10 Home.

Many users have experienced issues with Android-based virtual machines and emulators, especially BlueStacks and Andy Android Emulator, which crash on startup when the Hyper-V role is active. This problem seems to have arisen after the Anniversary Update, which broke compatibility between Hyper-V and these emulators. Fortunately, recent updates to BlueStacks have addressed this issue. As of June 2023, BlueStacks now supports running with Hyper-V enabled when using Android 9 Pie instances. This means you can enjoy both Hyper-V functionalities and BlueStacks without having to constantly toggle Hyper-V on and off.

In my previous attempts to find a workaround, I installed the x86Android Android Emulator in Hyper-V. Although I managed to get an older version running, I found its touchscreen support and controls inadequate for my needs. Given BlueStacks’ user-friendly interface and overall better experience, I prefer to switch between Hyper-V and BlueStacks setups as necessary. Previously, I would remove and reinstall the Hyper-V role whenever needed, but this approach has a significant drawback: it results in the loss of Hyper-V Virtual Switch Manager settings. Each time I reinstall Hyper-V, I have to recreate these settings and reattach them to each virtual machine, leading to numerous orphaned network adapters. For those who want a seamless experience without the hassle of managing Hyper-V settings repeatedly, keeping up with the latest version of BlueStacks that supports Hyper-V might be the best solution.


!!!Hyper-V Switch To The Rescue!!!

Calm down. This utility doesn’t allow Hyper-V to run simultaneously with VMWare, VirtualBox or BlueStacks, but this great tool I found at least saves a reboot (it takes two reboots if you add and remove the Hyper-V role). Also, I don’t have to reconfigure Virtual Switch Manager every time I do it. This program automates a bcdedit process to disable Hyper-V without removing the Hyper-V role as part of the process.

Use Hyper-V Switch to toggle Hyper-V support on and off when using other emulators like VirtualBox or Andy Android Emulator to keep it fast and simple. I saved it to my Desktop and edited the executable file to Run as Administrator just to be sure it has the rights needed. You can also single right-click on the executable file or shortcut and then single left-click on Run as Administrator every time.

https://github.com/ygoe/HyperVSwitch – Download from GitHub

http://unclassified.software/apps/hypervswitch – Hyper-V Switch Website


#Enable The Hyper-V Role Using PowerShell manually or for the first time

#For the first and if the only time enabling the Hyper-V role then the command  below is all you need.

Enable-WindowsOptionalFeature -Online -FeatureName:Microsoft-Hyper-V -All

#Enable Hyper-V and all features.

#Type y and press Enter


#Disable The Hyper-V Role Using PowerShell

#Disable Hyper-V and all features

#Type y and press Enter


Manually Enable Hyper-V From The GUI

Windows Key-R to bring up the Run box.

Type optionalfeatures.exe and single left-click OK to execute (just means to run) optionalfeatures.exe. This method actually allows for more control of the Hyper-V installation since you can deselect unneeded features. For example, some people may not have any need for the Hyper-V Module for Windows PowerShell module if they don’t use PowerShell  or PowerShell Direct to administer any virtual machines.

Single left-click to select the Hyper-V option. Single left-click the Plus sign to expand if you need to select or deselect any of the default features. I use all the Hyper-V features so PowerShell for this installation works just fine for me. The end goal is to avoid moving my mouse as much as possible.