{"id":278,"date":"2023-03-21T15:47:07","date_gmt":"2023-03-21T15:47:07","guid":{"rendered":"https:\/\/dalesdemo.xyz\/?post_type=projects&#038;p=278"},"modified":"2023-03-21T16:21:05","modified_gmt":"2023-03-21T16:21:05","slug":"script-to-change-all-users-pass-to-never-expire-on-local-account","status":"publish","type":"projects","link":"https:\/\/dalesdemo.xyz\/index.php\/projects\/script-to-change-all-users-pass-to-never-expire-on-local-account\/","title":{"rendered":"Script to change all users pass to never expire on local account"},"content":{"rendered":"\t\t<div data-elementor-type=\"wp-post\" data-elementor-id=\"278\" class=\"elementor elementor-278\" data-elementor-post-type=\"projects\">\n\t\t\t\t\t\t<section class=\"elementor-section elementor-top-section elementor-element elementor-element-5f285d0 elementor-section-boxed elementor-section-height-default elementor-section-height-default\" data-id=\"5f285d0\" data-element_type=\"section\">\n\t\t\t\t\t\t<div class=\"elementor-container elementor-column-gap-default\">\n\t\t\t\t\t<div class=\"elementor-column elementor-col-100 elementor-top-column elementor-element elementor-element-faec639\" data-id=\"faec639\" data-element_type=\"column\">\n\t\t\t<div class=\"elementor-widget-wrap elementor-element-populated\">\n\t\t\t\t\t\t<div class=\"elementor-element elementor-element-5c4e8cc elementor-widget elementor-widget-text-editor\" data-id=\"5c4e8cc\" data-element_type=\"widget\" data-widget_type=\"text-editor.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t<style>\/*! elementor - v3.23.0 - 05-08-2024 *\/\n.elementor-widget-text-editor.elementor-drop-cap-view-stacked .elementor-drop-cap{background-color:#69727d;color:#fff}.elementor-widget-text-editor.elementor-drop-cap-view-framed .elementor-drop-cap{color:#69727d;border:3px solid;background-color:transparent}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap{margin-top:8px}.elementor-widget-text-editor:not(.elementor-drop-cap-view-default) .elementor-drop-cap-letter{width:1em;height:1em}.elementor-widget-text-editor .elementor-drop-cap{float:left;text-align:center;line-height:1;font-size:50px}.elementor-widget-text-editor .elementor-drop-cap-letter{display:inline-block}<\/style>\t\t\t\t<p>Script gets and loops through local users and disables password expiry. This should work for Windows 7 and up, it will likely not work with Microsoft linked accounts<\/p>\t\t\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<div class=\"elementor-element elementor-element-cba7373 elementor-widget elementor-widget-code-highlight\" data-id=\"cba7373\" data-element_type=\"widget\" data-widget_type=\"code-highlight.default\">\n\t\t\t\t<div class=\"elementor-widget-container\">\n\t\t\t\t\t<div class=\"prismjs-default copy-to-clipboard \">\n\t\t\t<pre data-line=\"\" class=\"highlight-height language-javascript line-numbers\">\n\t\t\t\t<code readonly=\"true\" class=\"language-javascript\">\n\t\t\t\t\t<xmp># Get all local user accounts\r\n$users = Get-LocalUser\r\n\r\n# Loop through each user account and set password expiry to never\r\nforeach ($user in $users) {\r\n    Set-LocalUser -Name $user.Name -PasswordNeverExpires $true\r\n}<\/xmp>\n\t\t\t\t<\/code>\n\t\t\t<\/pre>\n\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/div>\n\t\t\t\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<\/div>\n\t\t","protected":false},"excerpt":{"rendered":"<p>I needed to prevent a desktop from having any passwords expire, so here&#8217;s a script to do it<\/p>\n","protected":false},"featured_media":0,"template":"","meta":{"_acf_changed":false},"categories":[12,17,19],"tags":[],"class_list":["post-278","projects","type-projects","status-publish","hentry","category-programming","category-script","category-tools"],"acf":[],"_links":{"self":[{"href":"https:\/\/dalesdemo.xyz\/index.php\/wp-json\/wp\/v2\/projects\/278","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalesdemo.xyz\/index.php\/wp-json\/wp\/v2\/projects"}],"about":[{"href":"https:\/\/dalesdemo.xyz\/index.php\/wp-json\/wp\/v2\/types\/projects"}],"version-history":[{"count":15,"href":"https:\/\/dalesdemo.xyz\/index.php\/wp-json\/wp\/v2\/projects\/278\/revisions"}],"predecessor-version":[{"id":305,"href":"https:\/\/dalesdemo.xyz\/index.php\/wp-json\/wp\/v2\/projects\/278\/revisions\/305"}],"wp:attachment":[{"href":"https:\/\/dalesdemo.xyz\/index.php\/wp-json\/wp\/v2\/media?parent=278"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalesdemo.xyz\/index.php\/wp-json\/wp\/v2\/categories?post=278"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalesdemo.xyz\/index.php\/wp-json\/wp\/v2\/tags?post=278"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}