{"id":618,"date":"2022-09-26T18:57:20","date_gmt":"2022-09-26T17:57:20","guid":{"rendered":"https:\/\/www.multi-net.ch\/?page_id=618"},"modified":"2022-09-26T19:03:43","modified_gmt":"2022-09-26T18:03:43","slug":"script-powershell","status":"publish","type":"page","link":"https:\/\/www.multi-net.ch\/?page_id=618","title":{"rendered":"Script PowerShell &#8211; Copier des donn\u00e9es en utilisant un partage IPC$"},"content":{"rendered":"\n<p>Ce script est utile lorsque l&rsquo;on souhaite copier des donn\u00e9es en utilisant robocopy, depuis un PC qui n&rsquo;est pas dans le domaine vers un autre qui lui est membre du domaine. Nous effectuons l&rsquo; authentification via la <a rel=\"noreferrer noopener\" href=\"https:\/\/fr.wikipedia.org\/wiki\/Communication_inter-processus\" target=\"_blank\">communication inter-processus<\/a> en utilisant NET USE.<\/p>\n\n\n\n<p>Le script poss\u00e8de malheureusement un d\u00e9faut, le mot de passe est en clair.   <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># COMPUTER FROM\r\n$IPCHost = \"COMPUTER_A\"              \t\t# Host name to create IPC$ share with\r\n$IPCUser = \"COMPUTER_A\\administrator\"       # Authentication \r\n$IPCPwd  = \"thepassword\"              \t\t# for IPC$ share\r\n$SrcDir  = \"c$\\folder\\\" + (get-date).year \t# Source Directory Path\r\n\r\n# COMPUTER TO                \t\t\t\t\r\n$DstHost = \"COMPUTER_B\"              \t\t# Destination Host Name\r\n$DstDir  = \"c$\\folder\\\" + (get-date).year \t# Destination Directory Path \r\n\r\n\r\n# Parameters (robocopy keys)        #\r\n$Params = \"\/E\"           # Specify needed robocopy.exe parameters here\r\n\r\n# Action Block                      #\r\nNET USE \\\\$IPCHost\\IPC$ \/u:$IPCUser $IPCPwd\r\nrobocopy.exe \\\\$IPCHost\\$SrcDir\\ \\\\$DstHost\\$DstDir\\ $Params \/LOG:$LogPath\r\nNET USE \\\\$IPCHost\\IPC$ \/D<\/code><\/pre>\n\n\n\n<p><\/p>\n<!--CusAds0-->\n<div style=\"font-size: 0px; height: 0px; line-height: 0px; margin: 0; padding: 0; clear: both;\"><\/div>","protected":false},"excerpt":{"rendered":"<p>Ce script est utile lorsque l&rsquo;on souhaite copier des donn\u00e9es en utilisant robocopy, depuis un PC qui n&rsquo;est pas dans le domaine vers un autre qui lui est membre du domaine. Nous effectuons l&rsquo; authentification via la communication inter-processus en &hellip; <a href=\"https:\/\/www.multi-net.ch\/?page_id=618\">Continuer la lecture <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-618","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/www.multi-net.ch\/index.php?rest_route=\/wp\/v2\/pages\/618","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.multi-net.ch\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.multi-net.ch\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.multi-net.ch\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.multi-net.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=618"}],"version-history":[{"count":3,"href":"https:\/\/www.multi-net.ch\/index.php?rest_route=\/wp\/v2\/pages\/618\/revisions"}],"predecessor-version":[{"id":621,"href":"https:\/\/www.multi-net.ch\/index.php?rest_route=\/wp\/v2\/pages\/618\/revisions\/621"}],"wp:attachment":[{"href":"https:\/\/www.multi-net.ch\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=618"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}