{"id":1540,"date":"2012-10-23T17:00:29","date_gmt":"2012-10-23T16:00:29","guid":{"rendered":"http:\/\/www.edwardsd.co.uk\/work\/?p=1540"},"modified":"2013-10-02T19:43:47","modified_gmt":"2013-10-02T18:43:47","slug":"uac-vbs-script","status":"publish","type":"post","link":"https:\/\/www.edwardsd.co.uk\/work\/2012\/10\/uac-vbs-script\/","title":{"rendered":"Enable\/Disable UAC | VBS"},"content":{"rendered":"<p>This will display a popup showing whether UAC is &#8220;Evalated&#8221; or &#8220;Not Evalated&#8221; using VBS<\/p>\n<pre lang=\"vbscript\" line=\"1\">Dim oShell, oExec, szStdOut\r\n\r\nszStdOut = \"\"\r\nSet oShell = CreateObject(\"WScript.Shell\")\r\nSet oExec = oShell.Exec(\"whoami \/groups\")\r\n\r\nDo While (oExec.Status = cnWshRunning)\r\nWScript.Sleep 100\r\nif not oExec.StdOut.AtEndOfStream then\r\nszStdOut = szStdOut &amp; oExec.StdOut.ReadAll\r\nend if\r\nLoop\r\nselect case oExec.ExitCode\r\ncase 0\r\nif not oExec.StdOut.AtEndOfStream then\r\nszStdOut = szStdOut &amp; oExec.StdOut.ReadAll\r\nend if\r\nif instr(szStdOut,\"S-1-16-12288\") Then\r\nwscript.echo \"Elevated\"\r\nelse\r\nif instr(szStdOut,\"S-1-16-8192\")\u00a0 Then\r\nwscript.echo \"Not Elevated\"\r\nelse\r\nwscript.echo \"Unknown!\"\r\nend if\r\nend if\r\ncase else\r\nif not oExec.StdErr.AtEndOfStream then\r\nwscript.echo oExec.StdErr.ReadAll\r\nend if\r\nend select<\/pre>\n<p>Thanks to: http:\/\/blogs.technet.com\/b\/jhoward\/archive\/2008\/11\/19\/how-to-detect-uac-elevation-from-vbscript.aspx<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This will display a popup showing whether UAC is &#8220;Evalated&#8221; or &#8220;Not Evalated&#8221; using VBS Dim oShell, oExec, szStdOut szStdOut = &#8220;&#8221; Set oShell = CreateObject(&#8220;WScript.Shell&#8221;) Set oExec = oShell.Exec(&#8220;whoami \/groups&#8221;) Do While (oExec.Status = cnWshRunning) WScript.Sleep 100 if not oExec.StdOut.AtEndOfStream then szStdOut = szStdOut &amp; oExec.StdOut.ReadAll end if Loop select case oExec.ExitCode case 0 [&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":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[8],"tags":[],"class_list":["post-1540","post","type-post","status-publish","format-standard","hentry","category-vbs"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pOPt8-oQ","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/1540","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=1540"}],"version-history":[{"count":0,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/posts\/1540\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/media?parent=1540"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/categories?post=1540"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.edwardsd.co.uk\/work\/wp-json\/wp\/v2\/tags?post=1540"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}