Please Refer this script if you want to Setup WinRM services on your computer.
What is WinRM?
Windows Remote Management (WinRM) is the Microsoft implementation of WS-Management Protocol, a standard Simple Object Access Protocol (SOAP)-based, firewall-friendly protocol that allows hardware and operating systems, from different vendors, to interoperate.
The WS-Management protocol specification provides a common way for systems to access and exchange management information across an IT infrastructure you can use WinRM scripting objects, the WinRM command-line tool, or the Windows Remote Shell command line tool WinRS to obtain management data from local and remote computers that may have baseboard management controllers (BMCs). If the computer runs a Windows-based operating system version that includes WinRM.\
I should be noted that BOTH computers i.e the remote system(TARGET SYSTEM) where you want to make change and the PC from where the command is send to the remote system(TARGET SYSTEM),must have WinRM installed and enabled on them for Windows Remote Shell command line tool WinRS to work and retrieve information from the remote system
Please Run this script as logged in user