{"id":7096,"date":"2026-01-03T01:28:41","date_gmt":"2026-01-02T16:28:41","guid":{"rendered":"https:\/\/appbay.org\/?p=7096"},"modified":"2026-01-03T01:30:56","modified_gmt":"2026-01-02T16:30:56","slug":"powershell-%e3%83%90%e3%83%83%e3%82%af%e3%82%a2%e3%83%83%e3%83%97%e3%82%b9%e3%82%af%e3%83%aa%e3%83%97%e3%83%88","status":"publish","type":"post","link":"https:\/\/appbay.org\/?p=7096","title":{"rendered":"PowerShell NAS\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30b9\u30af\u30ea\u30d7\u30c8"},"content":{"rendered":"<p>\u65b0\u3057\u3044NAS(Windows Server IoT)\u3092\u5c0e\u5165\u3057\u305f\uff61\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306b\u5c02\u7528\u306e\u30bd\u30d5\u30c8\u3092\u5c0e\u5165\u3059\u308b\u307b\u3069\u306e\u898f\u6a21\u3067\u3082\u306a\u3044\u306e\u3067PowerShell+\u30bf\u30b9\u30af\u30b9\u30b1\u30b8\u30e5\u30fc\u30e9\u306b\u3066\u8a2d\u5b9a\uff61<\/p>\n<p>-\u65e5\u6b21\u30df\u30e9\u30fc\u30ea\u30f3\u30b0\u30c7\u30fc\u30bf*2<br \/>\n-1\u9031\u9593\u5206\u306e\u5dee\u5206\u30c7\u30fc\u30bf<br \/>\n-\u6708\u6b21\u306e\u30df\u30e9\u30fc\u30ea\u30f3\u30b0\u30c7\u30fc\u30bf<\/p>\n<pre class=\"lang:ps decode:true \">$src = \"xxx\"\r\n$dst1 = \"xxx\"\r\n$dst2 = \"xxx\"\r\n$dif = \"xxx\"\r\n$mon = \"xxx\"\r\n\r\n$opt = @(\"\/R:3\", \"\/W:5\", \"\/NP\", \"\/NDL\")\r\n$today = Get-Date\r\n$dayNum = [int]$today.DayOfWeek\r\n\r\nrobocopy $src $dst1 \/MIR $opt\r\nrobocopy $src $dst2 \/MIR $opt\r\n\r\nif ($dayNum -ne 0) {\r\n  $targetDir = Join-Path $dif $dayNum\r\n  if (Test-Path $targetDir) { Remove-Item $targetDir -Recurse -Force }\r\n  New-Item -Path $targetDir -ItemType Directory -Force | Out-Null\r\n  $lastSunday = $today.AddDays(-$dayNum).ToString(\"yyyyMMdd\")\r\n  robocopy $src $targetDir \/S \/MAXAGE:$lastSunday $opt\r\n}\r\n\r\nif ($today.Day -eq 1) { robocopy $src $mon \/MIR $opt }\r\n  \r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u65b0\u3057\u3044NAS(Windows Server IoT)\u3092\u5c0e\u5165\u3057\u305f\uff61\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u306b\u5c02\u7528\u306e\u30bd\u30d5\u30c8\u3092\u5c0e\u5165\u3059\u308b\u307b\u3069\u306e\u898f\u6a21\u3067\u3082\u306a\u3044\u306e\u3067PowerShell+\u30bf\u30b9\u30af\u30b9\u30b1\u30b8\u30e5\u30fc\u30e9\u306b\u3066\u8a2d\u5b9a\uff61 -\u65e5\u6b21\u30df\u30e9\u30fc\u30ea\u30f3\u30b0\u30c7\u30fc\u30bf*2 -1\u9031\u9593\u5206\u306e\u5dee\u5206 &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/appbay.org\/?p=7096\" class=\"more-link\"><span class=\"screen-reader-text\">&#8220;PowerShell NAS\u30d0\u30c3\u30af\u30a2\u30c3\u30d7\u30b9\u30af\u30ea\u30d7\u30c8&#8221; \u306e<\/span>\u7d9a\u304d\u3092\u8aad\u3080<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[157],"class_list":["post-7096","post","type-post","status-publish","format-standard","hentry","category-1","tag-powershell"],"_links":{"self":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/7096","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=7096"}],"version-history":[{"count":4,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/7096\/revisions"}],"predecessor-version":[{"id":7100,"href":"https:\/\/appbay.org\/index.php?rest_route=\/wp\/v2\/posts\/7096\/revisions\/7100"}],"wp:attachment":[{"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=7096"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=7096"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/appbay.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=7096"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}