<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx</link><description>How to automatically set the color and title of *all* CMD shells based on admin/elevation status with a one-time, one-line configuration change to your system.</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Aaron Margosis' WebLog : Table of contents, Aaron Margosis' non-admin blog</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#1745676</link><pubDate>Fri, 23 Feb 2007 09:29:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1745676</guid><dc:creator>Aaron Margosis' WebLog : Table of contents, Aaron Margosis' non-admin blog</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://blogs.msdn.com/aaron_margosis/archive/2005/04/18/TableOfContents.aspx"&gt;http://blogs.msdn.com/aaron_margosis/archive/2005/04/18/TableOfContents.aspx&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#1745779</link><pubDate>Fri, 23 Feb 2007 10:20:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1745779</guid><dc:creator>Pavel Lebedinsky</dc:creator><description>&lt;p&gt;You could also do something like this:&lt;/p&gt;
&lt;p&gt;cacls %windir%\system32\config\systemprofile &amp;gt;nul 2&amp;gt;nul &amp;amp;&amp;amp; echo admin || echo non-admin&lt;/p&gt;
&lt;p&gt;This should work on both XP and Vista.&lt;/p&gt;
</description></item><item><title>re: Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#1748145</link><pubDate>Fri, 23 Feb 2007 19:46:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1748145</guid><dc:creator>Harris</dc:creator><description>&lt;P&gt;Aaron:&lt;/P&gt;
&lt;P&gt;Just an FYI, there's an error in MakeMeAdmin.ps1 that you referenced. &amp;nbsp;The "if" statement in the SuPowershell function should read "if($SuAccount)" not "if(!$SuAccount)".&lt;/P&gt;
&lt;P&gt;Otherwise, that's awesome, thanks for point it out!&lt;/P&gt;
&lt;P&gt;Harris&lt;/P&gt;
&lt;DIV class=ajmReply&gt;
&lt;P&gt;Harris -- thanks, yeah, that didn't look right to me either.&amp;nbsp; I tried to post your comments as a reply on that page, but I don't know whether it went through or not.&lt;/P&gt;
&lt;P&gt;-- Aaron&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>A much simpler way, if you habitually use the *same* admin account</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#1749640</link><pubDate>Sat, 24 Feb 2007 01:37:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1749640</guid><dc:creator>Ross Presser</dc:creator><description>&lt;P&gt;Put the bare command&lt;/P&gt;
&lt;P&gt;&amp;nbsp;COLOR FC&lt;/P&gt;
&lt;P&gt;in HKCU\software\microsoft\Command Processor *for the admin account only*. No test required.&lt;/P&gt;
&lt;P&gt;Of course if you have several admin accounts that you use -- e.g. a local one and a domain one -- put it in each one.&lt;/P&gt;
&lt;P&gt;On my own machine I sometimes run in an account which is not a Domain admin but is an admin of the local machine, and I need to distinguish. The BOOTCFG trick won't distinguish between them .. so I would depend on HKCU.&lt;/P&gt;
&lt;DIV class=ajmReply&gt;
&lt;P&gt;Ross:&amp;nbsp; The problem here is that with MakeMeAdmin on XP/2003 and with UAC's Admin-Approval Mode on Vista, you can have two CMD windows side by side running as the same user, one with admin/elevated permissions and the other not.&amp;nbsp; Tying to HKCU won't help.&lt;/P&gt;
&lt;P&gt;-- Aaron&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>Correctness of MakeMeAdmin.ps1</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#1758844</link><pubDate>Sun, 25 Feb 2007 23:20:50 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1758844</guid><dc:creator>Staffan Gustafsson</dc:creator><description>&lt;p&gt;I have to point out that the representation groups.archivesat.com of the script I wrote is incorrect. &lt;/p&gt;
&lt;p&gt;You can see a correct version at via google groups at &lt;a rel="nofollow" target="_new" href="http://groups.google.com/group/microsoft.public.windows.powershell/browse_frm/thread/bc7fb9969347dd4a/84ab68ebb0f486f3?lnk=st&amp;amp;q=makemeadmin.ps1&amp;amp;rnum=1#84ab68ebb0f486f3"&gt;http://groups.google.com/group/microsoft.public.windows.powershell/browse_frm/thread/bc7fb9969347dd4a/84ab68ebb0f486f3?lnk=st&amp;amp;q=makemeadmin.ps1&amp;amp;rnum=1#84ab68ebb0f486f3&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;On ArchiveSat, the critical lines says:&lt;/p&gt;
&lt;p&gt;if (!$SuAccount)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;$StartInfo = new-object System.Diagnostics.ProcessStartInfo&lt;/p&gt;
&lt;p&gt;On Google:&lt;/p&gt;
&lt;p&gt;if (!$SuAccount){ &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;} &lt;/p&gt;
&lt;p&gt;Makes quite a difference, doesn't it? :)&lt;/p&gt;
&lt;p&gt;/Staffan&lt;/p&gt;
</description></item><item><title>re: Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#1766019</link><pubDate>Tue, 27 Feb 2007 01:29:46 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1766019</guid><dc:creator>Ross Presser</dc:creator><description>&lt;P&gt;&amp;gt;&amp;gt; Ross: &amp;nbsp;The problem here is that with MakeMeAdmin on XP/2003 and with UAC's Admin-Approval Mode on Vista, you can have two CMD windows side by side running as the same user, one with admin/elevated permissions and the other not. &amp;nbsp;Tying to HKCU won't help. &amp;lt;&amp;lt;&lt;/P&gt;
&lt;P&gt;Aaron: Good point, and if I used MakeMeAdmin like I'm supposed to, I'd have hit that myself. :-) Well, is there some kind of test that can distinguish between local machine admin and domain admin?&lt;/P&gt;
&lt;DIV class=ajmReply&gt;
&lt;P&gt;Ross:&amp;nbsp; Perhaps something like "dir \\mydc\c$", replacing "mydc" with the name of a domain controller that's always online?&amp;nbsp; Or if it works in your environment, "dir \\%USERDNSDOMAIN%\c$"?&amp;nbsp; (Note that %USERDNSDOMAIN% should expand to nothing for local accounts -- which works for this purpose since you want local accounts to fail the test.)&lt;/P&gt;
&lt;P&gt;Let me know whether this works for you -- I plan to post an update on this topic in the next few days.&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;
&lt;P&gt;-- Aaron&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>re: Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#1771312</link><pubDate>Wed, 28 Feb 2007 02:50:36 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1771312</guid><dc:creator>anonymous</dc:creator><description>&lt;P&gt;Very bad thing I found out: it turns every Cmd Console into ANSI mode, yet all subsequently invoked Cmd instance pertain UNICODE.&lt;/P&gt;
&lt;P&gt;Test case:&lt;/P&gt;
&lt;P&gt;for /f "delims=" %i in ('dir /s /b /a-d') do echo "%i"&lt;/P&gt;
&lt;P&gt;This will break for the first file, since the cmd instance invoking the 'dir' command returns unicode, but the calling shell is ANSI and thus stumbles upon the Unicode BOM at the beginning.&lt;/P&gt;
&lt;DIV class=ajmReply&gt;
&lt;P&gt;Can you provide more clarification?&amp;nbsp; Every CMD is ANSI by default.&amp;nbsp; The only way I know of to make its pipe/redirection output be Unicode is by starting CMD with the /U switch.&amp;nbsp; I tried starting command shells with /U both with and without the AutoRun value and found no difference in the output -- and in particular, I saw no BOM in any of the output.&amp;nbsp; The specific test I tried was to run this command in the %TEMP% folder:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="Courier New"&gt;(for /f "delims=" %i in ('dir /s /b /a-d') do echo "%i") &amp;gt; dir.txt&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;-- Aaron&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>re: Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#1895486</link><pubDate>Fri, 16 Mar 2007 20:40:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1895486</guid><dc:creator>Ronnie Miller</dc:creator><description>&lt;P&gt;Here is a way to change the color if you are running under a Domain Administrator context.&lt;/P&gt;
&lt;P&gt;"c:\program files\windows resource kits\tools\ifmember.exe" "mydomain\domain admins" &amp;gt;nul 2&amp;gt;nul &amp;amp;&amp;amp; (color 07) || (color FC)&lt;/P&gt;
&lt;P&gt;-or you can copy ifmember.exe to somewhere in your path. &amp;nbsp;Of course, change mydomain to the name of your domain.&lt;/P&gt;
&lt;DIV class=ajmReply&gt;
&lt;P&gt;FYI to readers who don't already know this:&amp;nbsp; "ifmember.exe" comes with the Windows Server 2003 Resource Kit Tools, freely downloadable from microsoft.com.&lt;/P&gt;
&lt;P&gt;-- Aaron&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>re: Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#1920442</link><pubDate>Tue, 20 Mar 2007 19:47:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1920442</guid><dc:creator>Chris R</dc:creator><description>&lt;P&gt;I just wanted to let you know there are some side affects that cause things to break when using your bootcfg trick. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;For example we have a Visual Studio 2003 project which runs the following command line function as a Pre-Build Event. &amp;nbsp;&lt;/P&gt;
&lt;P&gt;xcopy ..\..\exe_dir ..\..\debug /d /e /y /EXCLUDE:..\..\exe_dir\exclude.txt&lt;/P&gt;
&lt;P&gt;With the trick in place it xcopy fails during the build, although the same code works fine from a command window.&lt;/P&gt;
&lt;P&gt;Visual Studio executes the command by generating the following batch file.&lt;/P&gt;
&lt;P&gt;Creating temporary file "r:\MyProject\Release\obj\MyDll\BAT000002.bat" with contents&lt;/P&gt;
&lt;P&gt;[&lt;/P&gt;
&lt;P&gt;@echo off&lt;/P&gt;
&lt;P&gt;xcopy ..\..\exe_dir ..\..\release /d /e /y /EXCLUDE:..\..\exe_dir\exclude.txt&lt;/P&gt;
&lt;P&gt;if errorlevel 1 goto VCReportError&lt;/P&gt;
&lt;P&gt;goto VCEnd&lt;/P&gt;
&lt;P&gt;:VCReportError&lt;/P&gt;
&lt;P&gt;echo Project : error PRJ0019: A tool returned an error code from "Copy exe_dir to release"&lt;/P&gt;
&lt;P&gt;exit 1&lt;/P&gt;
&lt;P&gt;:VCEnd&lt;/P&gt;
&lt;P&gt;]&lt;/P&gt;
&lt;P&gt;Creating command line "r:\MyProject\Release\obj\MyDll\BAT000002.bat"&lt;/P&gt;
&lt;P&gt;When run the output is:&lt;/P&gt;
&lt;P&gt;Copy exe_dir to release&lt;/P&gt;
&lt;P&gt;0 File(s) copied&lt;/P&gt;
&lt;P&gt;MyDll : error PRJ0002 : error result returned from 'r:\MyProject\release\obj\MyDll\bat000002.bat'&lt;/P&gt;
&lt;P&gt;Removing the AutoRun value fixes the problem, so I don't expect you to troubleshoot this. I just want to warn others. &amp;nbsp;&lt;/P&gt;
&lt;DIV class=ajmReply&gt;
&lt;P&gt;Chris R:&amp;nbsp; Thanks, I've been meaning to post a follow-up.&amp;nbsp; It's actually the COLOR command in the AutoRun value that messes up some Visual Studio build events.&amp;nbsp; It happens for Visual Studio 2005 as well.&lt;/P&gt;
&lt;P&gt;-- Aaron&lt;/P&gt;&lt;/DIV&gt;</description></item><item><title>re: Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#2033793</link><pubDate>Thu, 05 Apr 2007 20:18:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:2033793</guid><dc:creator>Jeff Chadbourne</dc:creator><description>&lt;p&gt;Thanks Chris R! &amp;nbsp;This was driving me nuts. I was getting Pre-build errors too, and couldn't figure out why.&lt;/p&gt;
&lt;p&gt;I was able to fix this by adding:&lt;/p&gt;
&lt;p&gt;&amp;amp; echo &amp;gt; nul&lt;/p&gt;
&lt;p&gt;which will run the echo after either the admin or non-admin commands run. &amp;nbsp;This will return errorlevel 0 to VS.Net which will allow the pre-build event to complete.&lt;/p&gt;
</description></item><item><title>Follow-up on "Setting color for *all* CMD shells based on admin/elevation status"</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#3530344</link><pubDate>Tue, 26 Jun 2007 01:14:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3530344</guid><dc:creator>Aaron Margosis' "Non-Admin" WebLog</dc:creator><description>&lt;p&gt;Improvements on my earlier post about setting color and title for CMD (and PowerShell) windows, based on admin/elevation status&lt;/p&gt;
</description></item><item><title>Follow-up on "Setting color for *all* CMD shells based on admin/elevation status"</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#3573880</link><pubDate>Thu, 28 Jun 2007 04:50:20 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:3573880</guid><dc:creator>Aaron Margosis' "Non-Admin" WebLog</dc:creator><description>&lt;p&gt;Improvements on my earlier post about setting color and title for CMD (and PowerShell) windows, based on admin/elevation status&lt;/p&gt;
</description></item><item><title>Ламинат цены</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#8891784</link><pubDate>Sun, 24 Aug 2008 14:34:40 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8891784</guid><dc:creator>ламинат</dc:creator><description>&lt;p&gt;1fThank's.3k I compleatly disagree with last post . &amp;nbsp;viw &lt;/p&gt;
&lt;p&gt;&amp;lt;a href=&amp;quot;&lt;a rel="nofollow" target="_new" href="http://skuper.ru&amp;quot;&amp;gt;паркет&amp;lt;/a&amp;gt;"&gt;http://skuper.ru&amp;quot;&amp;gt;паркет&amp;lt;/a&amp;gt;&lt;/a&gt; 3b&lt;/p&gt;
</description></item><item><title>re: Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#8998373</link><pubDate>Mon, 13 Oct 2008 20:57:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8998373</guid><dc:creator>Czerno</dc:creator><description>&lt;p&gt;Hi, Aaron! I wish to thank you for your great &amp;quot;non admin&amp;quot; postings !&lt;/p&gt;
&lt;p&gt;What command would you suggest for use on Windows 2000 (where bootcfg isn't available) to distinguish between admin/non admin status ? &lt;/p&gt;
&lt;p&gt;Also, I need something which will not depend on NTFS permissions. &lt;/p&gt;
&lt;p&gt;Thanks once more&lt;/p&gt;
&lt;p&gt;-- &lt;/p&gt;
&lt;p&gt;Czerno&lt;/p&gt;
</description></item><item><title>re: Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#8998393</link><pubDate>Mon, 13 Oct 2008 21:10:37 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8998393</guid><dc:creator>Czerno</dc:creator><description>&lt;p&gt;re my above question, found a solution viz &lt;/p&gt;
&lt;p&gt;use the command line registry tool reg.exe,&lt;/p&gt;
&lt;p&gt;for instance :&lt;/p&gt;
&lt;p&gt;reg update software\mytrick=1&lt;/p&gt;
&lt;p&gt;There might be more elegant ways...&lt;/p&gt;
&lt;p&gt;Regards&lt;/p&gt;
&lt;p&gt;-- &lt;/p&gt;
&lt;p&gt;Czerno&lt;/p&gt;
</description></item><item><title>re: Setting color for *all* CMD shells based on admin/elevation status</title><link>http://blogs.msdn.com/aaron_margosis/archive/2007/02/22/setting-color-for-all-cmd-shells-based-on-admin-elevation-status.aspx#9915232</link><pubDate>Fri, 30 Oct 2009 12:25:12 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9915232</guid><dc:creator>Ross Presser</dc:creator><description>&lt;p&gt;In Windows 7, BOOTCFG always always returns errorlevel 1, even when it succeeds when running as Administrator. Here's a refinement:&lt;/p&gt;
&lt;p&gt;(BOOTCFG /query 2&amp;gt;nul |FINDSTR Entries &amp;gt;nul) &amp;amp;&amp;amp; (COLOR 47) || (COLOR 07 &amp;amp; echo&amp;gt;nul)&lt;/p&gt;
&lt;p&gt;This uses FINDSTR to search the BOOTCFG output for the word &amp;quot;Entries&amp;quot;, which it should always have if it succeeds. It also adds the &amp;quot;echo&amp;gt;nul&amp;quot; for the non-admin case, to clear the errorlevel. &lt;/p&gt;
&lt;p&gt;Windows 7 already adds the &amp;quot;Administrator&amp;quot; to the title bar, but if you still need the color change, here it is.&lt;/p&gt;</description></item></channel></rss>