{"id":3022,"date":"2018-11-27T20:10:01","date_gmt":"2018-11-27T19:10:01","guid":{"rendered":"https:\/\/www.mariotti.de\/?p=3022"},"modified":"2018-11-27T20:10:01","modified_gmt":"2018-11-27T19:10:01","slug":"schreibberechtigung-mit-powershell-pruefen","status":"publish","type":"post","link":"https:\/\/dev.mariotti.de\/?p=3022","title":{"rendered":"Schreibberechtigung mit PowerShell pr\u00fcfen"},"content":{"rendered":"<p>Mit PowerShell pr\u00fcfen ob man in einem Verzeichnis Schreibberechtigung hat, so einfach geht es:<\/p>\n<pre><code class=\"language-powershell\">function Test-Write {\n    [CmdletBinding()]\n    param (\n        [parameter()] [ValidateScript({[IO.Directory]::Exists($_.FullName)})]\n        [IO.DirectoryInfo] $Path\n    )\n    try {\n        $testPath = Join-Path $Path ([IO.Path]::GetRandomFileName())\n        [IO.File]::Create($testPath, 1, 'DeleteOnClose') &gt; $null\n        return $true\n    } catch {\n        return $false\n    } finally {\n        Remove-Item $testPath -ErrorAction SilentlyContinue\n    }\n}\n\nTest-Write 'C:\\temp'<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Mit PowerShell pr\u00fcfen ob man in einem Verzeichnis Schreibberechtigung hat, mit dieser Funktion ganz einfach.<\/p>\n","protected":false},"author":2,"featured_media":2425,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[37],"tags":[],"class_list":["post-3022","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-powershell"],"_links":{"self":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/posts\/3022","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3022"}],"version-history":[{"count":0,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/posts\/3022\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=\/wp\/v2\/media\/2425"}],"wp:attachment":[{"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3022"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3022"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dev.mariotti.de\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3022"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}