{"id":296,"date":"2019-04-08T01:13:09","date_gmt":"2019-04-07T22:13:09","guid":{"rendered":"https:\/\/gronlier.fr\/blog\/?p=296"},"modified":"2020-06-30T22:45:22","modified_gmt":"2020-06-30T19:45:22","slug":"windows-preparation-for-remote-control-with-ansible","status":"publish","type":"post","link":"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/","title":{"rendered":"Windows preparation for remote control with Ansible"},"content":{"rendered":"\n<h3 class=\"wp-block-heading\" id=\"markdown-header-enabling-admin-account\">Enabling Admin account<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">net user administrator \/active:yes\nnet user administrator MyPassword<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Enable Remote access and configure firewall<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"># To be done on both side\nEnable-PSRemoting<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"markdown-header-cleaning\">Cleaning<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\"># To be done on both side \nwinrm enumerate winrm\/config\/listener\nwinrm delete winrm\/config\/Listener?Address=*+Transport=HTTP\nwinrm delete winrm\/config\/Listener?Address=*+Transport=HTTPS\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"markdown-header-setup\">Setup<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">$myFQDN=(Get-WmiObject win32_computersystem).DNSHostName+\".\"+(Get-WmiObject win32_computersystem).Domain\nNew-SelfSignedCertificate -DnsName $myFQDN -CertStoreLocation Cert:\\LocalMachine\\My\n$thumbprint=@(Get-ChildItem -Path Cert:\\LocalMachine\\My | Where {$_.DnsNameList -match \"$myFQDN\" }).Thumbprint\nwinrm create winrm\/config\/Listener?Address=*+Transport=HTTPS \"@{Hostname=\"\"$myFQDN\"\"; CertificateThumbprint=\"\"$thumbprint\"\"}\"\nSet-Item -Path WSMan:\\localhost\\Service\\Auth\\Basic -Value $true <\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">Host file<\/h3>\n\n\n\n<p>In a file name  hosts.cfg <\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">[targets]\nserver1 ansible_host=123.123.123.123 ansible_user=Administrateur ansible_password=secure_password\nserver2 ansible_host=123.123.123.123 ansible_user=Administrator ansible_password=secure_password\n\n[targets:vars]\nansible_connection=winrm\nansible_winrm_server_cert_validation=ignore\n<\/pre>\n\n\n\n<p>And in the playbook<\/p>\n\n\n\n<p> ---<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">---\n# This playbook tests the script module on Windows hosts\n- name: Run powershell script\n  hosts:\n    - server1\n    - server2\n  vars:\n    nsimul: 8\n    results_dir: C:\\results{{ nsimul }}\n  gather_facts: false\n  tasks: ...\n<\/pre>\n<div class='skype-share' data-href='https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/' data-lang='auto' data-style='large' data-source='WordPress' ><\/div><div style='clear:both;padding-bottom:10px;'><\/div>\n<div class=\"twitter-share\"><a href=\"https:\/\/twitter.com\/intent\/tweet?via=ticapix\" class=\"twitter-share-button\">Tweet<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Enabling Admin account net user administrator \/active:yes net user administrator MyPassword Enable Remote access and configure firewall # To be done on both side Enable-PSRemoting Cleaning # To be done on both side winrm enumerate winrm\/config\/listener winrm delete winrm\/config\/Listener?Address=*+Transport=HTTP winrm delete winrm\/config\/Listener?Address=*+Transport=HTTPS Setup $myFQDN=(Get-WmiObject win32_computersystem).DNSHostName+\".\"+(Get-WmiObject win32_computersystem).Domain New-SelfSignedCertificate -DnsName $myFQDN -CertStoreLocation Cert:\\LocalMachine\\My $thumbprint=@(Get-ChildItem -Path Cert:\\LocalMachine\\My | &hellip; <a href=\"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Windows preparation for remote control with Ansible<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[31,30],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v22.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Windows preparation for remote control with Ansible - Bits and Bytes<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Windows preparation for remote control with Ansible - Bits and Bytes\" \/>\n<meta property=\"og:description\" content=\"Enabling Admin account net user administrator \/active:yes net user administrator MyPassword Enable Remote access and configure firewall # To be done on both side Enable-PSRemoting Cleaning # To be done on both side winrm enumerate winrm\/config\/listener winrm delete winrm\/config\/Listener?Address=*+Transport=HTTP winrm delete winrm\/config\/Listener?Address=*+Transport=HTTPS Setup $myFQDN=(Get-WmiObject win32_computersystem).DNSHostName+&quot;.&quot;+(Get-WmiObject win32_computersystem).Domain New-SelfSignedCertificate -DnsName $myFQDN -CertStoreLocation Cert:LocalMachineMy $thumbprint=@(Get-ChildItem -Path Cert:LocalMachineMy | &hellip; Continue reading Windows preparation for remote control with Ansible &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/\" \/>\n<meta property=\"og:site_name\" content=\"Bits and Bytes\" \/>\n<meta property=\"article:published_time\" content=\"2019-04-07T22:13:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-06-30T19:45:22+00:00\" \/>\n<meta name=\"author\" content=\"ticapix\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"ticapix\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/\",\"url\":\"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/\",\"name\":\"Windows preparation for remote control with Ansible - Bits and Bytes\",\"isPartOf\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/#website\"},\"datePublished\":\"2019-04-07T22:13:09+00:00\",\"dateModified\":\"2020-06-30T19:45:22+00:00\",\"author\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc\"},\"breadcrumb\":{\"@id\":\"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/gronlier.fr\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Windows preparation for remote control with Ansible\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/gronlier.fr\/blog\/#website\",\"url\":\"https:\/\/gronlier.fr\/blog\/\",\"name\":\"Bits and Bytes\",\"description\":\"As the default template said: &quot;Just another WordPress site&quot;\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/gronlier.fr\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc\",\"name\":\"ticapix\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g\",\"caption\":\"ticapix\"},\"url\":\"https:\/\/gronlier.fr\/blog\/author\/admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Windows preparation for remote control with Ansible - Bits and Bytes","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/","og_locale":"en_US","og_type":"article","og_title":"Windows preparation for remote control with Ansible - Bits and Bytes","og_description":"Enabling Admin account net user administrator \/active:yes net user administrator MyPassword Enable Remote access and configure firewall # To be done on both side Enable-PSRemoting Cleaning # To be done on both side winrm enumerate winrm\/config\/listener winrm delete winrm\/config\/Listener?Address=*+Transport=HTTP winrm delete winrm\/config\/Listener?Address=*+Transport=HTTPS Setup $myFQDN=(Get-WmiObject win32_computersystem).DNSHostName+\".\"+(Get-WmiObject win32_computersystem).Domain New-SelfSignedCertificate -DnsName $myFQDN -CertStoreLocation Cert:LocalMachineMy $thumbprint=@(Get-ChildItem -Path Cert:LocalMachineMy | &hellip; Continue reading Windows preparation for remote control with Ansible &rarr;","og_url":"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/","og_site_name":"Bits and Bytes","article_published_time":"2019-04-07T22:13:09+00:00","article_modified_time":"2020-06-30T19:45:22+00:00","author":"ticapix","twitter_card":"summary_large_image","twitter_misc":{"Written by":"ticapix","Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/","url":"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/","name":"Windows preparation for remote control with Ansible - Bits and Bytes","isPartOf":{"@id":"https:\/\/gronlier.fr\/blog\/#website"},"datePublished":"2019-04-07T22:13:09+00:00","dateModified":"2020-06-30T19:45:22+00:00","author":{"@id":"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc"},"breadcrumb":{"@id":"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gronlier.fr\/blog\/2019\/04\/windows-preparation-for-remote-control-with-ansible\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gronlier.fr\/blog\/"},{"@type":"ListItem","position":2,"name":"Windows preparation for remote control with Ansible"}]},{"@type":"WebSite","@id":"https:\/\/gronlier.fr\/blog\/#website","url":"https:\/\/gronlier.fr\/blog\/","name":"Bits and Bytes","description":"As the default template said: &quot;Just another WordPress site&quot;","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gronlier.fr\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/9abd8d0260a4d942d7069de75446e2bc","name":"ticapix","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/gronlier.fr\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/94bba7228ec3665afea02078abebfa94?s=96&d=monsterid&r=g","caption":"ticapix"},"url":"https:\/\/gronlier.fr\/blog\/author\/admin\/"}]}},"_links":{"self":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts\/296"}],"collection":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/comments?post=296"}],"version-history":[{"count":15,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts\/296\/revisions"}],"predecessor-version":[{"id":334,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/posts\/296\/revisions\/334"}],"wp:attachment":[{"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/media?parent=296"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/categories?post=296"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gronlier.fr\/blog\/wp-json\/wp\/v2\/tags?post=296"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}