{"id":29,"date":"2016-04-25T14:54:04","date_gmt":"2016-04-25T12:54:04","guid":{"rendered":"http:\/\/rolig.dk\/?p=29"},"modified":"2016-04-25T14:54:04","modified_gmt":"2016-04-25T12:54:04","slug":"gpo-to-prepare-loginstartup-script-files","status":"publish","type":"post","link":"https:\/\/rolig.dk\/?p=29","title":{"rendered":"GPO to run login\/startup script files"},"content":{"rendered":"<p>Sometimes I need to do things when the computer starts up or when a user logon. A good way to do that is with a GPO startup script or a GPO logon script.<\/p>\n<h2>Prepare GPO to copy files<\/h2>\n<p>1. Create a new GPO<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb.png\" width=\"395\" height=\"186\"><\/a><\/p>\n<p>2. Edit the GPO and go to: Computer Configuration \u2013&gt; Preferences \u2013&gt; Files<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-1.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-1.png\" width=\"396\" height=\"246\"><\/a><\/p>\n<p>3. Right click the white area in the right pane and click New \u2013&gt; File<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-2.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-2.png\" width=\"553\" height=\"217\"><\/a><\/p>\n<p>4. Action = Replace, Source file(s) = \u201cThe folder where you have you scripts.\u201d, Destination folder = \u201cThe folder where you want to copy the scripts\u201d, Archive = Yes.<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-3.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-3.png\" width=\"444\" height=\"495\"><\/a><\/p>\n<p>5. Mark \u201cRemove this item when it is no longer applied\u201d. Click \u201cOk\u201d<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-21.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-21.png\" width=\"449\" height=\"503\"><\/a><\/p>\n<p>Then you need to link the policy to a OU.<\/p>\n<p>You have now created a GPO the will copy the scripts to a local folder. The files will be download to the folder again if the user is deleting or changing the files.<\/p>\n<h2>Create GPO to run the files<\/h2>\n<p>Next we need to create a GPO that run the scripts<\/p>\n<p>1. Create a new GPO<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-4.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-4.png\" width=\"468\" height=\"221\"><\/a><\/p>\n<h3>To create a Computer startup script<\/h3>\n<p>1. For computer startup scripts, go to: Computer Configuration \u2013&gt; Policies \u2013&gt; Windows Settings \u2013&gt; Scripts (Startup\/Shutdown)<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-5.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-5.png\" width=\"481\" height=\"221\"><\/a><\/p>\n<p>2. Double click on \u201cStartup\u201d on the right pane<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-6.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-6.png\" width=\"437\" height=\"118\"><\/a><\/p>\n<p>3. Click \u201cAdd\u201d<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-7.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-7.png\" width=\"423\" height=\"472\"><\/a><\/p>\n<p>4. Choose the script that you have copied with the 1. GPO that we created and click \u201cOk\u201d<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-8.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-8.png\" width=\"453\" height=\"236\"><\/a><\/p>\n<p>5. Click \u201cOk\u201d<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-9.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-9.png\" width=\"453\" height=\"505\"><\/a><\/p>\n<p>You have now a script that will run from the C drive every time the computer starts<\/p>\n<h3>To create a User logon script<\/h3>\n<p>1. For user login scripts, go to: User Configuration \u2013&gt; Policies \u2013&gt; Windows Settings \u2013&gt; Scripts (Logon\/Logoff)<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-10.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-10.png\" width=\"477\" height=\"203\"><\/a><\/p>\n<p>2. Double click on \u201cLogon\u201d on the right pane<\/p>\n<p><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-11.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-11.png\" width=\"477\" height=\"134\"><\/a><\/p>\n<p>3. Click \u201cAdd\u201d<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-12.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-12.png\" width=\"421\" height=\"467\"><\/a><\/p>\n<p>4. Choose the script that you have copied with the 1. GPO that we created and click \u201cOk\u201d<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-13.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-13.png\" width=\"435\" height=\"225\"><\/a><\/p>\n<p>5. Click \u201cOk\u201d<br \/><a href=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image-14.png\"><img loading=\"lazy\" decoding=\"async\" title=\"image\" style=\"border-left-width: 0px; border-right-width: 0px; background-image: none; border-bottom-width: 0px; padding-top: 0px; padding-left: 0px; display: inline; padding-right: 0px; border-top-width: 0px\" border=\"0\" alt=\"image\" src=\"https:\/\/rolig.dk\/wp-content\/uploads\/2016\/04\/image_thumb-14.png\" width=\"438\" height=\"489\"><\/a><\/p>\n<p>You have now a script that will run from the C drive every time a user is logging on.<\/p>\n<p>&nbsp;<\/p>\n<p>I normally I add a delay in the scripts. Because then I sure that the computer have a network connection. In case the scripts needs to pull some setting or other stuff from the network.<\/p>\n<a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-twitter nolightbox\" data-provider=\"twitter\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Twitter\" href=\"https:\/\/twitter.com\/intent\/tweet?url=https%3A%2F%2Frolig.dk%2Findex.php%3Frest_route%3D%252Fwp%252Fv2%252Fposts%252F29&amp;text=Hey%20check%20this%20out\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px;margin-right:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"twitter\" title=\"Share on Twitter\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/rolig.dk\/wp-content\/plugins\/social-media-feather\/synved-social\/addons\/extra-icons\/image\/social\/circle\/96x96\/twitter.png\" \/><\/a><a class=\"synved-social-button synved-social-button-share synved-social-size-48 synved-social-resolution-single synved-social-provider-linkedin nolightbox\" data-provider=\"linkedin\" target=\"_blank\" rel=\"nofollow\" title=\"Share on Linkedin\" href=\"https:\/\/www.linkedin.com\/shareArticle?mini=true&amp;url=https%3A%2F%2Frolig.dk%2Findex.php%3Frest_route%3D%252Fwp%252Fv2%252Fposts%252F29&amp;title=GPO%20to%20run%20login%2Fstartup%20script%20files\" style=\"font-size: 0px;width:48px;height:48px;margin:0;margin-bottom:5px\"><img loading=\"lazy\" decoding=\"async\" alt=\"linkedin\" title=\"Share on Linkedin\" class=\"synved-share-image synved-social-image synved-social-image-share\" width=\"48\" height=\"48\" style=\"display: inline;width:48px;height:48px;margin: 0;padding: 0;border: none;box-shadow: none\" src=\"https:\/\/rolig.dk\/wp-content\/plugins\/social-media-feather\/synved-social\/addons\/extra-icons\/image\/social\/circle\/96x96\/linkedin.png\" \/><\/a>","protected":false},"excerpt":{"rendered":"<p>Sometimes I need to do things when the computer starts up or when a user logon. A good way to do that is with a GPO startup script or a GPO logon script. Prepare GPO to copy files 1. Create a new GPO 2. Edit the GPO and go to: Computer Configuration \u2013&gt; Preferences \u2013&gt; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[7],"tags":[12],"class_list":["post-29","post","type-post","status-publish","format-standard","hentry","category-windows-10","tag-gpologinlogonscript"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/rolig.dk\/index.php?rest_route=\/wp\/v2\/posts\/29","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/rolig.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/rolig.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/rolig.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/rolig.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=29"}],"version-history":[{"count":0,"href":"https:\/\/rolig.dk\/index.php?rest_route=\/wp\/v2\/posts\/29\/revisions"}],"wp:attachment":[{"href":"https:\/\/rolig.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=29"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/rolig.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=29"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/rolig.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=29"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}