{"id":67,"date":"2020-05-19T06:48:47","date_gmt":"2020-05-19T06:48:47","guid":{"rendered":"http:\/\/allan-kjaer.dk\/?page_id=67"},"modified":"2025-10-28T13:54:36","modified_gmt":"2025-10-28T13:54:36","slug":"gists","status":"publish","type":"page","link":"https:\/\/allan-kjaer.dk\/?page_id=67","title":{"rendered":"POWERSHELL &amp; GITHUB GISTS"},"content":{"rendered":"\n<p><strong><a href=\"https:\/\/techallan.blogspot.com\/\" data-type=\"link\" data-id=\"https:\/\/techallan.blogspot.com\/\" target=\"_blank\" rel=\"noreferrer noopener\">Archived PowerShell scripts<\/a><\/strong><\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p>Use to start all Remote Desktop services that should have been started automatically and are not running:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/a276d64fc6b2d935a9af851bdd743e92.js\"><\/script>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Use to find out if a host or device is up\/reachable before starting applications. I use this script in Windows autostart, but I only want to launch applications if I know that my company network is reachable (run <em>shell:startup<\/em> in Windows and place a batch file there that tells PowerShell to run the script at logon: &#8216;C:\\Windows\\System32\\WindowsPowerShell\\v1.0\\powershell.exe -file C:\\scripts\\if_host_is_up_do.ps1&#8217;):<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/15f6873b52340a65a5ab1021e4094254.js\"><\/script>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Use to export and import Windows NPS server configuration. Run every, e.g. 1 hour, to have 2 servers with same NPS configuration:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/e4135b2c43d767bda5af821a98c5edb7.js\"><\/script>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Use script to RoboCopy files and folders and run a deduplication job between RoboCopy commands. Wait for deduplication job to finish before issuing next RoboCopy command:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/0af6b6a805ead7f4e15f3e4a896f0530.js\"><\/script>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Use script to modify all user profile shares with new server name and new folder name:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/f0a46c172f4dfc07476d61243b8beb52.js\"><\/script>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Use to get all VHD disks from VMs on Hyper-V hypervisor and export data to CSV<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/5110e1540b11068a89d133cc65851cc9.js\"><\/script>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Use to move all .log files older than 1 day to another folder:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/d5833d41f8ba0059b1dbc2698affddaa.js\"><\/script>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Use script to check if HyperV virtual machines are not running. If any are not running, then send warning mail and start them. Check again after 3 minutes and send a new status mail:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/9b62ce7b2c4ba2a10efe00f601dd933b.js\"><\/script>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Use script to replace text or string in description on MS Active Directory objects:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/2ecfd4d2f3e8118850ca0eec1a2195f5.js\"><\/script>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Use script to test connection to website. If the test fails, run and log a traceroute:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/25a49eb160e56959d7d2df4aadd78e7b.js\"><\/script>\n\n\n\n<hr class=\"wp-block-separator has-css-opacity\"\/>\n\n\n\n<p>Use to check for available Windows updates and send a warning mail if any:<\/p>\n\n\n\n<script src=\"https:\/\/gist.github.com\/techallan\/de69d1b65fb071ac4e3e9a6b542c2825.js\"><\/script>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Archived PowerShell scripts Use to start all Remote Desktop services that should have been started automatically and are not running: Use to find out if a host or device is up\/reachable before starting applications. I use this script in Windows autostart, but I only want to launch applications if I know that my company network &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/allan-kjaer.dk\/?page_id=67\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;POWERSHELL &amp; GITHUB GISTS&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"open","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-67","page","type-page","status-publish","hentry","entry"],"_links":{"self":[{"href":"https:\/\/allan-kjaer.dk\/index.php?rest_route=\/wp\/v2\/pages\/67","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/allan-kjaer.dk\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/allan-kjaer.dk\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/allan-kjaer.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/allan-kjaer.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=67"}],"version-history":[{"count":14,"href":"https:\/\/allan-kjaer.dk\/index.php?rest_route=\/wp\/v2\/pages\/67\/revisions"}],"predecessor-version":[{"id":124,"href":"https:\/\/allan-kjaer.dk\/index.php?rest_route=\/wp\/v2\/pages\/67\/revisions\/124"}],"wp:attachment":[{"href":"https:\/\/allan-kjaer.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=67"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}