{"id":1528,"date":"2015-06-01T00:00:27","date_gmt":"2015-05-31T23:00:27","guid":{"rendered":"http:\/\/www.edwardsd.co.uk\/work\/?p=1528"},"modified":"2016-10-05T20:29:33","modified_gmt":"2016-10-05T19:29:33","slug":"windows-server-2012-install-desktop-experience-powershell","status":"publish","type":"post","link":"https:\/\/www.edwardsd.co.uk\/work\/2015\/06\/windows-server-2012-install-desktop-experience-powershell\/","title":{"rendered":"Windows Commands | Powershell"},"content":{"rendered":"<p>A few random PowerShell commands in Windows to help complete tasks:<\/p>\n<p><strong>Create New AD User:<\/strong><\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">New-ADUser -SamAccountName U1 -Name &quot;User 1&quot; -AccountPassword (ConvertToSecureString -AsPlainText &quot;p@ssw0rd&quot; -Force) -Enabled $true -Path 'OU=Test,DC=FABRIKAM,DC=COM'<\/pre>\n<p><strong>Displays if &#8220;Desktop Experience&#8221; is installed:<\/strong><\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Get-WindowsFeature *Desktop*<\/pre>\n<p><strong>Installs &#8220;Desktop Experience&#8221; Feature:<\/strong><\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Add-WindowsFeature Desktop-Experience<\/pre>\n<p><strong>Remove Windows Patches<\/strong><\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">wusa \/uninstall \/kb:2952664<\/pre>\n<p><strong>Clear all log entries<\/strong><br \/>\nAlthough previous logs in event viewer can be helpful for diagnostics, I find old errors sometime cloud the current issues. In order to quickly clear all evertvwr logs entries you can use the following powershell command<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">wevtutil el | Foreach-Object {Write-Host &quot;Clearing $_&quot;; wevtutil cl &quot;$_&quot;}<\/pre>\n<p><strong>Bypass code Execution<\/strong><\/p>\n<p>Usually if you get this error &#8220;PowerShell says \u201cexecution of scripts is disabled on this system.&#8221; the quick option is to bypass the execution policy:<\/p>\n<pre class=\"brush: powershell; title: ; notranslate\" title=\"\">Set-ExecutionPolicy Unrestricted<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>A few random PowerShell commands in Windows to help complete tasks: Create New AD User: New-ADUser -SamAccountName U1 -Name &quot;User 1&quot; -AccountPassword (ConvertToSecureString -AsPlainText &quot;p@ssw0rd&quot; -Force) -Enabled $true -Path &#8216;OU=Test,DC=FABRIKAM,DC=COM&#8217; Displays if &#8220;Desktop Experience&#8221; is installed: Get-WindowsFeature *Desktop* Installs &#8220;Desktop Experience&#8221; Feature: Add-WindowsFeature Desktop-Experience Remove Windows Patches wusa \/uninstall \/kb:2952664 Clear all log entries Although [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_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}},"categories":[30,23,44],"tags":[],"class_list":["post-1528","post","type-post","status-publish","format-standard","hentry","category-powershell","category-windows-server-2008","category-windows-server-2012"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pOPt8-oE","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/1528","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/comments?post=1528"}],"version-history":[{"count":8,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/1528\/revisions"}],"predecessor-version":[{"id":2950,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/1528\/revisions\/2950"}],"wp:attachment":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/media?parent=1528"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/categories?post=1528"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/tags?post=1528"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}