{"id":5201,"date":"2019-06-24T17:00:48","date_gmt":"2019-06-24T15:00:48","guid":{"rendered":"https:\/\/www.razumny.no\/?p=5201"},"modified":"2019-05-29T09:32:02","modified_gmt":"2019-05-29T07:32:02","slug":"how-to-run-a-powershell-script","status":"publish","type":"post","link":"https:\/\/www.razumny.no\/?p=5201","title":{"rendered":"How to run a PowerShell script"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">As has been the case so many times before, this week I&#8217;m bringing you the direct result of a customer request. The customer in question needed to know how to run a .ps1 script. As you may or may not know, double-clicking the script defaults to editing the script. At any rate, here&#8217;s how you do it:<\/p>\n\n\n\n<ol class=\"wp-block-list\"><li>Open the Start menu<\/li><li>Search for PowerShell<\/li><li>Open PowerShell<\/li><li>Drag and drop the .ps1-file into the PowerShell window<\/li><li>Hit Enter<\/li><li>Allow the magic to happen<\/li><\/ol>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"403\" height=\"235\" src=\"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-1.png?resize=403%2C235&#038;ssl=1\" alt=\"\" class=\"wp-image-5202\" srcset=\"https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-1.png?w=403&amp;ssl=1 403w, https:\/\/i0.wp.com\/www.razumny.no\/wp-content\/uploads\/image-1.png?resize=300%2C175&amp;ssl=1 300w\" sizes=\"auto, (max-width: 403px) 100vw, 403px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>As has been the case so many times before, this week I&#8217;m bringing you the direct result of a customer request. The customer in question needed to know how to run a .ps1 script. As you may or may not know, double-clicking the script defaults to editing the script. At any rate, here&#8217;s how you [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_hide_featured_image":false,"_jetpack_featured_image_duplicate_dismissed":0,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[615,380,677],"tags":[969],"class_list":["post-5201","post","type-post","status-publish","format-standard","hentry","category-how-to-2","category-tech-support","category-tips-tricks","tag-powershell"],"jetpack_publicize_connections":[],"jetpack_shortlink":"https:\/\/wp.me\/p2ukSU-1lT","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":2485,"url":"https:\/\/www.razumny.no\/?p=2485","url_meta":{"origin":5201,"position":0},"title":"List user home folder size","author":"Aleksander Nordgarden-R\u00f8dner","date":"30\/06\/2014","format":false,"excerpt":"Users\u00a0tend to store all kinds of crud on their network home folders, which can be a constant source of frustration for SysAdmins. Luckily, it is fairly easy to\u00a0get a list of the size of each folder, using a Powershell script. The script has already been made for us. It\u00a0is discussed\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":4297,"url":"https:\/\/www.razumny.no\/?p=4297","url_meta":{"origin":5201,"position":1},"title":"Powershell: Exporting Active Directory Contacts","author":"Aleksander Nordgarden-R\u00f8dner","date":"16\/10\/2017","format":false,"excerpt":"Some time ago, I needed to have a list of all Contacts registered in Active Directory. Knowing that there are a lot of them (numbering at least eighty), getting the data manually was not a viable alternative, particularly knowing that the same objective can be achieved through Powershell. I eventually\u2026","rel":"","context":"In &quot;code examples&quot;","block_context":{"text":"code examples","link":"https:\/\/www.razumny.no\/?cat=119"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7000,"url":"https:\/\/www.razumny.no\/?p=7000","url_meta":{"origin":5201,"position":2},"title":"PowerShell: Return multiple specific properties","author":"Aleksander Nordgarden-R\u00f8dner","date":"12\/12\/2022","format":false,"excerpt":"The script I described a few weeks ago for finding all members of several groups is serving me very well indeed. I was recently asked to provide both the display name and the login name for each member in the group. This was readily achieved by modifying the script slightly.\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":7049,"url":"https:\/\/www.razumny.no\/?p=7049","url_meta":{"origin":5201,"position":3},"title":"PowerShell: Finding host name from IP address","author":"Aleksander Nordgarden-R\u00f8dner","date":"23\/01\/2023","format":false,"excerpt":"In tech support, resolving IP addresses to host names can be something you do on a relatively frequent basis. While I've always used the CLI ping command with the -a option, I have also been working towards higher proficiency in PowerShell. Frankly, for a single IP address, I prefer sticking\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":6979,"url":"https:\/\/www.razumny.no\/?p=6979","url_meta":{"origin":5201,"position":4},"title":"Powershell: A script to find all members of several groups refined","author":"Aleksander Nordgarden-R\u00f8dner","date":"07\/11\/2022","format":false,"excerpt":"One of the scripts that I use most often is the one I wrote about back in September of 2019. Usually, I only run it for up to ten or so groups, so it's not a big problem to simply swap out the group name, rince and repeat. Recently, however,\u2026","rel":"","context":"In &quot;How To&quot;","block_context":{"text":"How To","link":"https:\/\/www.razumny.no\/?cat=615"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":5270,"url":"https:\/\/www.razumny.no\/?p=5270","url_meta":{"origin":5201,"position":5},"title":"PowerShell: Building a script to find all members of several given groups","author":"Aleksander Nordgarden-R\u00f8dner","date":"16\/09\/2019","format":false,"excerpt":"Last week, I showed you how I find all the nested members of a specified group. When we get requests for such audits, however, they usually specify doing so for a number of groups. Now, we could of course do it, one group at a time, adding information to our\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/www.razumny.no\/?cat=820"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"jetpack_featured_media_url":"","_links":{"self":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/5201","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5201"}],"version-history":[{"count":1,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/5201\/revisions"}],"predecessor-version":[{"id":5203,"href":"https:\/\/www.razumny.no\/index.php?rest_route=\/wp\/v2\/posts\/5201\/revisions\/5203"}],"wp:attachment":[{"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5201"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5201"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.razumny.no\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5201"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}