Skip to content

Provision Window VM instance with powershell script that enables WinRM and RDP on OS up from Windows 7.

Notifications You must be signed in to change notification settings

denis-kalinin/winrm-rdp-enabler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 

Repository files navigation

winrm-rdp-enabler

Provision Window VM instance with powershell script that enables:

  • WinRM
  • RDP
  • SSH*
  • rsync*

on OS up from Windows 7 SP1.

why you may need this?

Let you want to launch a VM (virtual machine) in a cloud—AWS, Openstack, Auzre, et cetera—with arbitrary image of Windows OS – how do you install software on the VM, configure settings?

When you are going to spawn VM instance in a cloud you have an option to pass cloud-init script in Powershell language (for Windows OS). This script will run only once at the end of VM's creation. Cloud-init leads us to a couple of ways how to achive our goals (install and configure software on VM):

  1. mega-script that installs and configure all software you need – BAD
  2. script that downloads and installs any of CM (configuration management) tools—SaltStack, Ansimble, Chef —then just pull/push appropriate configuration from you CM server – NOT BAD
  3. enable WinRM (à la SSH for Windows) on VM – GOOD – contemporary IaC tools (infrastucture as code), like CloudFormation, Terraform and Vagrant, can execute VM's post-creation tasks: upload files to VM, execute sets of commands on VM, but they need a communication tool—WinRM (service supports execution of Powershell scripts remotely).

what does the script do?

  1. sets VM's network interfaces as Private – Windows very restricts communications on Public interfaces
  2. enables WinRM over HTTP
  3. enables execution of .ps1 files on VM
  4. enables RDP – you may view VM's desktop now
  5. creates local administrator (LocalAdmin, you can change this) – sometimes it is very hard to figure out automatically the password and correct name of build-in Administrator (may vary depending on localization), that is why we need our own admin. Set your IaC tool to use this credentials.
  6. (optional) install SSH and rsync—if you wish to opt-in uncomment last strings
    • copies your pki public key from the cloud to LocalAdmin's profile
    • installs CYGWIN with rsync package
    • installs and run OpenSSH

About

Provision Window VM instance with powershell script that enables WinRM and RDP on OS up from Windows 7.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published