{"id":240,"date":"2018-04-12T13:02:49","date_gmt":"2018-04-12T12:02:49","guid":{"rendered":"https:\/\/www.alsacloud.fr\/?p=240"},"modified":"2018-04-12T13:02:49","modified_gmt":"2018-04-12T12:02:49","slug":"modification-registre-distant-powershell","status":"publish","type":"post","link":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/","title":{"rendered":"Modification registre distant Powershell"},"content":{"rendered":"<p>Un petit article pour pr\u00e9senter un script qui va permettre de faire des modifications dans le registre d&rsquo;un pc distant d&rsquo;un domaine AD.<\/p>\n<p>Pour faire cela il va nous falloir les droits d&rsquo;admin pour le pc distant.<br \/>\nil est alors possible d\u2019ex\u00e9cuter le script suivant \u00e0 partir d&rsquo;une console PowerShell<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">\r\n\r\n$PcName = &quot;FR-CHA-NB1329&quot;\r\n$Win32_ComputerSystem = get-wmiobject -class Win32_ComputerSystem -computername $PcName\r\n#R\u00e9cup\u00e9ration du nom d'utilisateur connect\u00e9 sur le pc distant\r\n$ADaccount = $Win32_ComputerSystem.UserName\r\n#Suppression du domaine dans la chaine de caract\u00e8res\r\n$ADaccount= $ADaccount.Substring($ADaccount.Length-9,9)\r\n#R\u00e9cup\u00e9ration des informations de compte dans l'active Directory\r\n$ADaccount = get-aduser $ADaccount\r\n#R\u00e9cup\u00e9ration du SID du compte afin de joindre la bonne ruche dans le registre\r\n$SID = $ADaccount.SID\r\n\r\n#Affichage du SID recup\u00e9r\u00e9\r\nwrite-host $SID\r\n\r\nInvoke-Command -ComputerName $PcName -ScriptBlock {\r\n$RegKey = &quot;Microsoft.PowerShell.Core\\Registry::HKEY_USERS\\&quot; + $args&#x5B;0] + &quot;\\Network\\r&quot;\r\n#suppression de la cl\u00e9 en question\r\nremove-Item -Path $RegKey\r\n\r\n#Autres possiblit\u00e9s\r\n#Cr\u00e9ation d'une cl\u00e9 de registre\r\n#New-Item -Path $RegKey\r\n\r\n#Cr\u00e9ation d'une valeur dans une cl\u00e9 de registre\r\n#Set-ItemProperty -Path $RegKey -Name ExcludeHttpsRootDomain -Value 1\r\n\r\n#Lecture d'une valeur dans une cl\u00e9 de registre\r\n#get-ItemProperty -Path $RegKey -Name ExcludeHttpsRootDomain\r\n\r\n} -ArgumentList $SID\r\n\r\n<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"mh-excerpt\"><p>Un petit article pour pr\u00e9senter un script qui va permettre de faire des modifications dans le registre d&rsquo;un pc distant d&rsquo;un domaine AD. Pour faire cela il va nous falloir les droits d&rsquo;admin pour le <a class=\"mh-excerpt-more\" href=\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/\" title=\"Modification registre distant Powershell\">[Lire la suite&#8230;]<\/a><\/p>\n<\/div>","protected":false},"author":1,"featured_media":202,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[10],"tags":[],"class_list":["post-240","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Modification registre distant Powershell - Alsacloud.fr<\/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:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/\" \/>\n<meta property=\"og:locale\" content=\"fr_FR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Modification registre distant Powershell - Alsacloud.fr\" \/>\n<meta property=\"og:description\" content=\"Un petit article pour pr\u00e9senter un script qui va permettre de faire des modifications dans le registre d&rsquo;un pc distant d&rsquo;un domaine AD. Pour faire cela il va nous falloir les droits d&rsquo;admin pour le [Lire la suite...]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/\" \/>\n<meta property=\"og:site_name\" content=\"Alsacloud.fr\" \/>\n<meta property=\"article:published_time\" content=\"2018-04-12T12:02:49+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2016\/01\/powershell2.png\" \/>\n\t<meta property=\"og:image:width\" content=\"658\" \/>\n\t<meta property=\"og:image:height\" content=\"492\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Christophe\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u00c9crit par\" \/>\n\t<meta name=\"twitter:data1\" content=\"Christophe\" \/>\n\t<meta name=\"twitter:label2\" content=\"Dur\u00e9e de lecture estim\u00e9e\" \/>\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\":\"Article\",\"@id\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/\"},\"author\":{\"name\":\"Christophe\",\"@id\":\"https:\/\/www.alsacloud.fr\/#\/schema\/person\/0078f7716937efc19bcc4190ba04a0e1\"},\"headline\":\"Modification registre distant Powershell\",\"datePublished\":\"2018-04-12T12:02:49+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/\"},\"wordCount\":220,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/www.alsacloud.fr\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2016\/01\/powershell2.png\",\"articleSection\":[\"PowerShell\"],\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/\",\"url\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/\",\"name\":\"Modification registre distant Powershell - Alsacloud.fr\",\"isPartOf\":{\"@id\":\"https:\/\/www.alsacloud.fr\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2016\/01\/powershell2.png\",\"datePublished\":\"2018-04-12T12:02:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#breadcrumb\"},\"inLanguage\":\"fr-FR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#primaryimage\",\"url\":\"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2016\/01\/powershell2.png\",\"contentUrl\":\"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2016\/01\/powershell2.png\",\"width\":658,\"height\":492},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Accueil\",\"item\":\"https:\/\/www.alsacloud.fr\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Modification registre distant Powershell\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.alsacloud.fr\/#website\",\"url\":\"https:\/\/www.alsacloud.fr\/\",\"name\":\"Alsacloud.fr\",\"description\":\"Un savoir local pour une technologie dans les nuages...\",\"publisher\":{\"@id\":\"https:\/\/www.alsacloud.fr\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.alsacloud.fr\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"fr-FR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.alsacloud.fr\/#organization\",\"name\":\"Alsacloud\",\"url\":\"https:\/\/www.alsacloud.fr\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/www.alsacloud.fr\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2018\/08\/alsacloud-court.jpg\",\"contentUrl\":\"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2018\/08\/alsacloud-court.jpg\",\"width\":236,\"height\":57,\"caption\":\"Alsacloud\"},\"image\":{\"@id\":\"https:\/\/www.alsacloud.fr\/#\/schema\/logo\/image\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.alsacloud.fr\/#\/schema\/person\/0078f7716937efc19bcc4190ba04a0e1\",\"name\":\"Christophe\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"fr-FR\",\"@id\":\"https:\/\/www.alsacloud.fr\/#\/schema\/person\/image\/\",\"url\":\"http:\/\/0.gravatar.com\/avatar\/3d25575aea1327ae348baec67484323c?s=96&d=mm&r=g\",\"contentUrl\":\"http:\/\/0.gravatar.com\/avatar\/3d25575aea1327ae348baec67484323c?s=96&d=mm&r=g\",\"caption\":\"Christophe\"},\"description\":\"Passionn\u00e9 d'informatique et de nouvelles technologies depuis mon plus jeune \u00e2ge je souhaite partager ici quelques recherches que j'ai effectu\u00e9s.\",\"sameAs\":[\"http:\/\/www.alsalcoud.fr\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Modification registre distant Powershell - Alsacloud.fr","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:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/","og_locale":"fr_FR","og_type":"article","og_title":"Modification registre distant Powershell - Alsacloud.fr","og_description":"Un petit article pour pr\u00e9senter un script qui va permettre de faire des modifications dans le registre d&rsquo;un pc distant d&rsquo;un domaine AD. Pour faire cela il va nous falloir les droits d&rsquo;admin pour le [Lire la suite...]","og_url":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/","og_site_name":"Alsacloud.fr","article_published_time":"2018-04-12T12:02:49+00:00","og_image":[{"width":658,"height":492,"url":"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2016\/01\/powershell2.png","type":"image\/png"}],"author":"Christophe","twitter_card":"summary_large_image","twitter_misc":{"\u00c9crit par":"Christophe","Dur\u00e9e de lecture estim\u00e9e":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#article","isPartOf":{"@id":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/"},"author":{"name":"Christophe","@id":"https:\/\/www.alsacloud.fr\/#\/schema\/person\/0078f7716937efc19bcc4190ba04a0e1"},"headline":"Modification registre distant Powershell","datePublished":"2018-04-12T12:02:49+00:00","mainEntityOfPage":{"@id":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/"},"wordCount":220,"commentCount":0,"publisher":{"@id":"https:\/\/www.alsacloud.fr\/#organization"},"image":{"@id":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2016\/01\/powershell2.png","articleSection":["PowerShell"],"inLanguage":"fr-FR","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/","url":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/","name":"Modification registre distant Powershell - Alsacloud.fr","isPartOf":{"@id":"https:\/\/www.alsacloud.fr\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#primaryimage"},"image":{"@id":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#primaryimage"},"thumbnailUrl":"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2016\/01\/powershell2.png","datePublished":"2018-04-12T12:02:49+00:00","breadcrumb":{"@id":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#breadcrumb"},"inLanguage":"fr-FR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/"]}]},{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#primaryimage","url":"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2016\/01\/powershell2.png","contentUrl":"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2016\/01\/powershell2.png","width":658,"height":492},{"@type":"BreadcrumbList","@id":"https:\/\/www.alsacloud.fr\/index.php\/scripting\/powershell\/modification-registre-distant-powershell\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Accueil","item":"https:\/\/www.alsacloud.fr\/"},{"@type":"ListItem","position":2,"name":"Modification registre distant Powershell"}]},{"@type":"WebSite","@id":"https:\/\/www.alsacloud.fr\/#website","url":"https:\/\/www.alsacloud.fr\/","name":"Alsacloud.fr","description":"Un savoir local pour une technologie dans les nuages...","publisher":{"@id":"https:\/\/www.alsacloud.fr\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.alsacloud.fr\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"fr-FR"},{"@type":"Organization","@id":"https:\/\/www.alsacloud.fr\/#organization","name":"Alsacloud","url":"https:\/\/www.alsacloud.fr\/","logo":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.alsacloud.fr\/#\/schema\/logo\/image\/","url":"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2018\/08\/alsacloud-court.jpg","contentUrl":"https:\/\/www.alsacloud.fr\/wp-content\/uploads\/2018\/08\/alsacloud-court.jpg","width":236,"height":57,"caption":"Alsacloud"},"image":{"@id":"https:\/\/www.alsacloud.fr\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.alsacloud.fr\/#\/schema\/person\/0078f7716937efc19bcc4190ba04a0e1","name":"Christophe","image":{"@type":"ImageObject","inLanguage":"fr-FR","@id":"https:\/\/www.alsacloud.fr\/#\/schema\/person\/image\/","url":"http:\/\/0.gravatar.com\/avatar\/3d25575aea1327ae348baec67484323c?s=96&d=mm&r=g","contentUrl":"http:\/\/0.gravatar.com\/avatar\/3d25575aea1327ae348baec67484323c?s=96&d=mm&r=g","caption":"Christophe"},"description":"Passionn\u00e9 d'informatique et de nouvelles technologies depuis mon plus jeune \u00e2ge je souhaite partager ici quelques recherches que j'ai effectu\u00e9s.","sameAs":["http:\/\/www.alsalcoud.fr"]}]}},"_links":{"self":[{"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/posts\/240"}],"collection":[{"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/comments?post=240"}],"version-history":[{"count":4,"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/posts\/240\/revisions"}],"predecessor-version":[{"id":244,"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/posts\/240\/revisions\/244"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/media\/202"}],"wp:attachment":[{"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/media?parent=240"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/categories?post=240"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.alsacloud.fr\/index.php\/wp-json\/wp\/v2\/tags?post=240"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}