<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bohack &#187; Windows</title>
	<atom:link href="http://www.bohack.com/tag/windows/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bohack.com</link>
	<description>Check In and Tune Out!</description>
	<lastBuildDate>Wed, 24 Feb 2010 18:55:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=abc</generator>
		<item>
		<title>Mastering Permissions with icacls.exe Command thru the GUI</title>
		<link>http://www.bohack.com/2009/12/mastering-permissions-with-icacls-exe-command-thru-the-gui/</link>
		<comments>http://www.bohack.com/2009/12/mastering-permissions-with-icacls-exe-command-thru-the-gui/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 15:41:37 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[CMD]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=350</guid>
		<description><![CDATA[The key to mastering permissions at the command line in Vista and Windows Server 2008 Server is learning the icacls.exe command. With the introduction of Windows Vista, you can no longer select multiple items like folders and files and apply permissions to a group of objects.]]></description>
			<content:encoded><![CDATA[<p>The key to mastering permissions at the command line in Vista and Windows Server 2008 Server is learning the icacls.exe command. With the introduction of Windows Vista, you can no longer select multiple items like folders and files and apply permissions to a group of objects. The recommended way is to use the command line and the icacls.exe command.</p>
<p><span id="more-350"></span><br />
The icacls.exe command was introduced in Windows 2003 Service Pack 2. It now comes installed by default in Windows Vista, Windows Server 2008 (R2) and Windows 7. So administrators will need to learn this command sooner or later. Recently I found the tool to be very flexible and I extensively documented the options. I mapped the different command line options to the GUI, for the network admins that need the GUI to understand how to use the command line.</p>
<p>The first point that should be made about icacls.exe is that it defaults to edit mode. The original cacls command defaults to replace mode. Next are the commands:</p>
<pre>/grant will grant user permissions or the add option in the GUI.
/remove will remove the user from the DACL and is equivalent to
 the remove option in the GUI.

Note: /remove:g will remove only grants for the user
      and /remove:d will remove only denys for the user.

/deny is equivalent to the deny column in the GUI
 and should always be used cautiously.
/setowner is a handy little command which allows you to change
 the ownership of a file or folder to another user;
 this is similar to the linux chown command.
/findsid which finds entries in a DACL for a specified SID or user.
/setintegritylevel is a bit out of the scope of this article
 and may be in a future article.</pre>
<p>The icacls command also has an /inheritance command which performs the same function as un-checking the “Include inheritable permission from this object’s parent” in the GUI. This of course presents you with the question of how to proceed; copy the permissions or remove all existing permissions. So the command line you can specify:</p>
<pre>/inheritance:e to enable same as a check box in the GUI.
/inheritance:d to disable and copy the permissions
 from the parent same as the GUI.
/inheritance:r to disable and remove the
 current permissions again same as the GUI.</pre>
<a href="http://www.bohack.com/wp-content/uploads/2009/12/icacls-gui.jpg"  rel="lightbox[350]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/photojar/cache/icacls-gui-150x150-1-img355.jpg" alt="Windows GUI mapped to icacls commands" title="icacls-gui" width="150" height="150" class="aligncenter size-thumbnail wp-image-355" /></a>
<p>The next thing to learn is how inheritance is propagated for permissions. When using either the /grant or /deny statement you will build the permissions as <em>/grant {user}:{inheritance}{permissions}</em> everything is encapsulated by parenthesis. The default in Windows when applying permissions in the GUI is “This folder, subfolders and files”, but to achieve the default at the command line you need to use <em>/grant {user}: (OI)(CI){permissions}</em> and the permissions should be encapsulated in parenthesis. The table below is to help you formulate your inheritance for permissions:</p>
<pre>This folder only
This folder, subfolders and files (OI)(CI)
This folder and subfolders (CI)
This folder and files (OI)
Subfolders and files only (OI)(CI)(NP)(IO)
Subfolders only (CI)(IO)
Files only (OI)(IO)</pre>
<p>The last thing to learn is the permissions. You can use macro permissions, which are also called simple permissions or you can use advanced permissions. The simple permissions are the permissions found in the first properties tab under security. The advanced permissions are when you select advanced and you get the full permissions list. So building on the permissions line from above; if we wanted to grant testuser on the folder test and apply modify permissions so all subfolders and files inherited the permissions. The line would be ‘<em>icacls test /grant testuser:(OI)(CI)(M)</em>’</p>
<pre>Simple Permissions

Full Control (F)
Modify (M)
Read &amp; Execute (RX)
List Folder Contents (X,RD,RA,REA,RC)
Read (R)
Write (W)

Advanced Permissions

Full Control (F)
Traverse folder / execute file (X)
List folder / read data (RD)
Read attributes (RA)
Read extended attributes (REA)
Create file / write data (WD)
Create folders / append data (AD)
Write attributes (WA)
Write extended attributes (WEA)
Delete subfolders and files (DC)
Delete (D)
Read permissions (RC)
Change permissions (WDAC)
Take ownership (WO)</pre>
<p>When you master this command you will be able to do anything with permissions from the command line. Including understanding the SDDL or Security Descriptor Definition Language; which Microsoft uses to create group policy permissions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/12/mastering-permissions-with-icacls-exe-command-thru-the-gui/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mac OS X Permissions Problems with Window Server 2003 R2</title>
		<link>http://www.bohack.com/2009/12/mac-os-x-permissions-problems-with-window-server-2003-r2/</link>
		<comments>http://www.bohack.com/2009/12/mac-os-x-permissions-problems-with-window-server-2003-r2/#comments</comments>
		<pubDate>Wed, 09 Dec 2009 03:11:34 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[OSX]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=336</guid>
		<description><![CDATA[A user on a Mac OS X client with not be able to drag files into the folder or perform a copy procedure and will result in the error: "You may need to enter the name and password for an administrator on this computer to change the item name "item-name".".]]></description>
			<content:encoded><![CDATA[<p>Recently I found a problem when using Mac OS X and Windows Server 2003 R2 as a file server. The problem exists in the permissions that are applied to user folders. When applying permissions to shares you normally start out with a very restrictive permission structure at the top. As you create the folders you add permissions for users and groups to permit and restrict access for others. This structure of permissions is very common in dealing with corporate shares. We also share the folder with ‘domain users’ only having change or modify access to the entire share. This eliminates people applying their own permissions and locking everyone out including themselves. This is a common task for a network admin in setting up permissions.<br />
<span id="more-336"></span><br />
We have a Windows Server 2003 R2 file server with a directory called ‘Drives’ this directory is shared with ‘Domain Admins’ and ‘System’ Full Control and ‘Domain Users’ Change Control. Under this directory the permissions are structures as follows at the NTFS level. Domain Users have Read permissions only to the folder and does not inherit down to other folders. This allows a Domain User to read the directory names, but not access the contents in each of the folders. Each folder at this level is names according to the user that owns the content. On these folders we add the domain user’s username with Change control and we allow the permissions to inherit to all child folders and file below.</p>
<p>The problem exists when you use a script to create the folders and apply the permissions using the cacls.exe command on a Windows 2003 R2 server. A user on a Mac OS X client with not be able to drag files into the folder on a Windows 2003 R2 server share or perform a copy procedure and will result in the error: <strong>&#8220;You may need to enter the name and password for an administrator on this computer to change the item name &#8220;item-name&#8221;</strong>.&#8221;. You may also see the exclamation error if the file has a preview fork attached of <strong>&#8220;Couldn&#8217;t open the file. It may be corrupt or a file format that Preview doesn&#8217;t recognize.&#8221;</strong>. After much reading on this problem I was almost convinced that it was an OS X bug, but I realize now it is actually a flaw in the cacls command. We use a script similar to the snippet of code below to create the directories.</p>
<pre>mkdir \\server\share\userdir
cacls \\server\share\userdir /e /t /g userdir:c

explanation:

cacls {file or folder} /e {edits} /t {changes on all sub directories} /g {grants} userdir:c {user:permission of change}</pre>
<p>The problem was solved using the command that was introduced in Vista and Server 2003 R2 called icacls.exe. The icacls tool is now included in Windows Server Service Pack 2 and is standard in Vista. This command allows you to set inheritance, which is the root cause of the problem. The inheritance properties were first introduced in NTFS 5.0 with Windows 2000, however something has changed recently in the OS X 10.5 software or Windows Server 2003 R2. The problem also exists in Windows Server 2008 and Windows Server 2008 R2 so the problem is not going away and I am guessing it is OSX at fault.</p>
<p>When setting a directory with the code above, if you use the icacls command to export the permissions structure out to a file you can see the problem. This will export the security into Microsoft’s SDDL language which is documented here http://msdn.microsoft.com/en-us/library/aa379567(VS.85).aspx.</p>
<pre>icacls.exe \\server\share\userdir /save aclfile.txt

notepad.exe aclfile.txt

D:(A;OICI;0x1301bf;;;S-1-5-21-123456789-123456789-123456789-12345) (A;OICIID;FA;;;DA)(A;OICIID;FA;;;SY)
(user:chage) (domain admin:full) (system:full)</pre>
<p>The problem is not is not evident until we set the permission properly with the icacls.exe command.</p>
<pre>icacls \\server\share\userdir /t /c /grant userdir:(OI)(CI)M

explanation:

icacls {file or folder} /t {changes on all sub directories} /grant {grants} userdir:(OI)(CI) {see below}M { change/modify }

CI CONTAINER INHERIT
OI OBJECT INHERIT
NP NO PROPAGATE INHERIT
IO INHERIT ONLY
ID INHERITED
SA SUCCESSFUL ACCESS FLAG
FA FAILED ACCESS FLAG

Complete list http://msdn.microsoft.com/en-us/library/aa374928(VS.85).aspx

D:AI(A;OICI;0x1301bf;;;S-1-5-21-123456789-123456789-123456789-12345) (A;OICIID;FA;;;DA)(A;OICIID;FA;;;SY)

Explanation:

D: - Defines the DACL
AI - is the MISSING Auto Inheritance Flag
(A;OICI;0x1301bf;;;S-1-5-21-123456789-123456789-123456789-12345) - is the user’s SID and permissions
(A;OICIID;FA;;;DA) - is the “Domain Admin” permissions identified by the trailing DA
(A;OICIID;FA;;;SY) - is the “System” permissions identified by the trailing SY</pre>
<p>The AI in the DACL or Discretionary Access Control List is missing when using the cacls command. My guess is that the client when using Windows is responsible for the completion and writing of the DACL. When a Mac OS X client copies a file they utilize SAMBA which does not carry the DACL and consequentially fails. This would explain the empty file that gets created when an OS X client drags and drops the file. The file entry gets created, but is inherited with only the original permissions that have inheritance from above. This same problem could also exist on Linux or UNIX using SAMBA since it is SAMBA that drops the ball.</p>
<p>The Fix:</p>
<p>Use ‘icacls \\server\share\userdir /t /c /grant username:(OI)(CI)M’ to grant access to NTFS folders and replace all entries in scripts using the cacls command.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/12/mac-os-x-permissions-problems-with-window-server-2003-r2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get the URL from a hyperlink in Excel</title>
		<link>http://www.bohack.com/2009/06/get-the-url-from-a-hyperlink-in-excel/</link>
		<comments>http://www.bohack.com/2009/06/get-the-url-from-a-hyperlink-in-excel/#comments</comments>
		<pubDate>Sun, 14 Jun 2009 17:01:59 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Excel]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=324</guid>
		<description><![CDATA[Recently I needed to extract a links from a web page; normally I would use some Linux commands ported to windows and get the job done. In the end I needed to format the relative link to a full URL, so I decided to use Excel. However when I imported the web page into excel [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I needed to extract a links from a web page; normally I would use some Linux commands ported to windows and get the job done. In the end I needed to format the relative link to a full URL, so I decided to use Excel. However when I imported the web page into excel I found that the URL was embedded in the friendly name of the hyperlink.</p>
<p><span id="more-324"></span>The hyperlink command in excel actually does the reverse of what I needed; it creates a hyperlink out of the URL and a friendly name and I needed the URL from the friendly name. So I dug in a little deeper and treated the URL like an object. It has properties and those properties can be exposed. The hyperlinkcell object has a type of range so it is passed to the function of GETURL. The first hyperlink in the range we will want the property of the address. Then we simply pass it back to the function so that we can display it.</p>
<p>To install this all you need to do is:</p>
<ol>
<li>Hit ALT + F11 (Opens Visual Basic Editor)</li>
<li>Click on Insert -&gt; Module (adds a module to your excel file)</li>
<li>Paste the code below for the function of GETURL</li>
<li>Hit ALT + Q (Closes the Visual Basic Editor)</li>
</ol>
<p>Now use the =GETURL(cell) to get the URL</p>
<p>Example: =GETURL(A1) will return the URL for the Hyperlink displayed in cell A1</p>
<pre>Function GETURL(HyperlinkCell As Range)

 GETURL = HyperlinkCell.Hyperlinks(1).Address

End Function</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/06/get-the-url-from-a-hyperlink-in-excel/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Default Back to Search Companion</title>
		<link>http://www.bohack.com/2009/02/how-to-default-back-to-search-companion/</link>
		<comments>http://www.bohack.com/2009/02/how-to-default-back-to-search-companion/#comments</comments>
		<pubDate>Tue, 03 Feb 2009 14:59:26 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=272</guid>
		<description><![CDATA[Microsoft Search should not be feared, it is now an optional install from Microsoft Update Services. It is integrates into Office 2007 for email search capability. However one problem is it changes the default search of Windows Explorer to Desktop Search. So it has pissed off a lot of people and made them uninstall it. [...]]]></description>
			<content:encoded><![CDATA[<p>Microsoft Search should not be feared, it is now an optional install from Microsoft Update Services. It is integrates into Office 2007 for email search capability. However one problem is it changes the default search of Windows Explorer to Desktop Search. So it has pissed off a lot of people and made them uninstall it. There is hope and a way to switch it back.</p>
<p><span id="more-272"></span>Yep, it&#8217;s replaced the standard Windows search companion (and the friendly dog â€“ Rover from MS Bob). That&#8217;s all well and good, except it&#8217;s an indexed search so doesn&#8217;t necessarily reflect what&#8217;s really on disk. And since by default my program files folder isn&#8217;t indexed, it never shows any results no matter what I search for &#8211; until I go in and change the settings then wait for it to get around to indexing the folders.</p>
<p>There&#8217;s a link at the bottom of the tab to use the trusty old search companion, but it means clicking it every time. Oh, and before you ask, no, there isn&#8217;t an option to disable this irritating integration in WDS! I hate it when software comes along and arrogantly replaces existing functionality with itself and gives no way to remove it.</p>
<p>You can in fact turn it off&#8230; Simply open RegEdit (hit Start &gt; Run then type &#8216;<strong>regedit</strong>&#8216;).<br />
Go to the following node:</p>
<p><strong>HKEY_CURRENT_USER\Software\Microsoft\Windows Desktop Search\DS</strong></p>
<p>Then double-click on &#8216;<strong>ShowStartSearchBand</strong>&#8216; and set the value to &#8216;<strong>0</strong>&#8216;. Close that and you&#8217;re done. The next time you click &#8216;Search&#8217; in explorer the old and reliable search companion will appear. This applies to operating systems before Windows Vista, since Vista has far better search that actually works!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/02/how-to-default-back-to-search-companion/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Exchange 2007 Interop RGC Connector Foo</title>
		<link>http://www.bohack.com/2009/01/exchange-2007-interop-rgc-connector-foo/</link>
		<comments>http://www.bohack.com/2009/01/exchange-2007-interop-rgc-connector-foo/#comments</comments>
		<pubDate>Thu, 15 Jan 2009 14:58:10 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=252</guid>
		<description><![CDATA[When upgrade from Exchange 2000 or 2003 to Exchange 2007 you must perform a transition. Mainly because you can not upgrade the binaries on the Exchange 2003 box to 2007, 2003 is 32 bit and 2007 is 64 bit. During the transition you will need to have the 2003 Exchange Routing Group connected to the [...]]]></description>
			<content:encoded><![CDATA[<p>When upgrade from Exchange 2000 or 2003 to Exchange 2007 you must perform a transition. Mainly because you can not upgrade the binaries on the Exchange 2003 box to 2007, 2003 is 32 bit and 2007 is 64 bit. During the transition you will need to have the 2003 Exchange Routing Group connected to the 2007 Exchange Routing Group. This will allow you to delever mail to recipients on both platforms and keep business continuity. You connect the two with a Routing Group Connector and I advise you use the Exchange Manager Console to manage them.</p>
<p><span id="more-252"></span>Generally when you install the Hub Transport Role it will ask you to create a Routing Group Connector in the GUI Wizard. However if you are like me and move roles around you will find the connector is broken. So first we need to learn how to test it. Pretty simple make a new user&#8217;s mailbox on the Exchange 2007 unit and from a mailbox located on Exchange 2003 unit send a piece of mail. If it works the Exchange 2007 user&#8217;s mailbox will have the email. Now create an email on the Exchange 2007 unit and send it to the user on the exchange 2003 unit. This is the quickest way to check the Routing Group Connectors, granted other problems can exist like the connector permissions.</p>
<p>If it fails you will need to delete the connector and recreate the connector. So first let us examine the connectors. You can use the &#8220;Get-RoutingGroupConnector&#8221; to display any existing Routing Group Connectors. By attaching an &#8220;fl&#8221; to the end of the command we can get full details &#8220;Get-RoutingGroupCOnnector | fl&#8221;.</p>
<p>Using the &#8220;Remove-RoutingGroupConnector&#8221; command we can remove any broken Routing Group Connectors. We will get to that in a minute however before you create a new &#8220;Interop RGC&#8221; connector&#8221; you need to verify that you have performed the &#8220;<a href="http://technet.microsoft.com/en-us/library/aa996728.aspx">How To Suppress Link State Updates</a>&#8221; Technet article on Exchange 2003. Then Identify the Bridge Head server in your 2003 and 2007 Exchange groups, these will be the connector endpoints.</p>
<p>Now using the &#8220;Remove-RoutingGroupConnector&#8221; command remove the existing connector.</p>
<p style="padding-left: 30px;">example: Remove-RoutingGroupConnector -identity &#8220;connector name or GUID&#8221;</p>
<p>Now to create the two connectors to move mail in both directions using the &#8220;New-RoutingGroupConnector&#8221; command.</p>
<p style="padding-left: 30px;">example: New-RoutingGroupConnector -Name &#8220;Interop RGC&#8221; -SourceTransportServers &#8220;Ex2007Hub.example.com&#8221; -TargetTransportServers &#8220;Ex2003.example.com&#8221; -Cost 100 -Bidirectional $true -PublicFolderReferralsEnabled $true</p>
<p>That will create a bidirectional link between the two servers however now we have the problem of removal, when you are done with the Exchange 2003 unit. If you perform a &#8220;Remove-RoutingGroupConnector&#8221; on the &#8220;Interop RGC&#8221; connector it will fail with the error of Multiple Instances.</p>
<p style="padding-left: 30px;">example: Remove-RoutingGroupConnector -identity &#8220;Interop RGC&#8221;</p>
<p>Not a problem you can handle this two ways: The first is to delete the link from the 2003 Echange Server Manager, the second is the correct way. Use the command &#8220;Get-RoutingGroupCOnnector | fl&#8221; to display the full GUID from the 2007 EMC and then delete each connector by their GUID. This is the best way as the EMC will gracefully destroy the connectors and supress future errors.</p>
<p style="padding-left: 30px;">example: Remove-RoutingGroupConnector -identity &#8220;Connector GUID&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/01/exchange-2007-interop-rgc-connector-foo/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exchange 2007 Legacy Mailbox Problem</title>
		<link>http://www.bohack.com/2009/01/exchange-2007-legacy-mailbox-problem/</link>
		<comments>http://www.bohack.com/2009/01/exchange-2007-legacy-mailbox-problem/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 18:58:04 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Exchange]]></category>
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=247</guid>
		<description><![CDATA[I am starting to warm up to Exchange 2007 and found that anything and everything can be fixed through the Exchange Management Shell. Recently I transitioned an Exchange 2003 administrative group to Exchange 2007. After migrating the users from the Exchange 2003 to Exchange 2007, I decided to check to see if creating a mailbox [...]]]></description>
			<content:encoded><![CDATA[<p>I am starting to warm up to Exchange 2007 and found that anything and everything can be fixed through the Exchange Management Shell. Recently I transitioned an Exchange 2003 administrative group to Exchange 2007. After migrating the users from the Exchange 2003 to Exchange 2007, I decided to check to see if creating a mailbox is the same. So I opened the (ADUC) Active Directory Users and Computers MMC and ran through the creation of a new user and mailbox. When I went back to the Exchange Management Console the &#8220;Recipient Type Details&#8221; showed as &#8220;Legacy Mailbox&#8221;.</p>
<p><span id="more-247"></span>After searching as to why this happens or what exactly happens, it states in http://technet.microsoft.com/en-us/library/bb123981.aspx that this will happen if the 2003 tools are used. What I suspect is that certain attributes that need to be set are not when using the Exchange 2003 ADUC. When the Exchange Management Console reads the mailbox it shows a Legacy Mailbox. So uninstall Exchange 2003 tools from other administrators workstations, you can reference the Knowledge Base Article KB931747 at http://support.microsoft.com/kb/931747 if they need proof.</p>
<p>To rectify the &#8220;Legacy Mailbox&#8221; and convert it back to a &#8220;User Mailbox&#8221; that can be managed in the Exchange Management Console: open the Exchange Management Shell and type in &#8216;Set-Mailbox -Identity &#8220;Alias&#8221; -ApplyMandatoryProperties&#8217;. Replace Alias with the alias of the mailbox that can be found in the Exchange Management Console.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2009/01/exchange-2007-legacy-mailbox-problem/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Command Prompt Anywhere</title>
		<link>http://www.bohack.com/2008/12/command-prompt-anywhere/</link>
		<comments>http://www.bohack.com/2008/12/command-prompt-anywhere/#comments</comments>
		<pubDate>Sun, 14 Dec 2008 19:06:01 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[CMD]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=165</guid>
		<description><![CDATA[Any day you can walk up to my workstation at work and find a command prompt open. Whether it is a Windows CMD prompt or a Linux Shell; I actually prefer it over the Windows GUI and over a KDE or Gnome on Linux. I can generally get more done in a few keystrokes then [...]]]></description>
			<content:encoded><![CDATA[<p>Any day you can walk up to my workstation at work and find a command prompt open. Whether it is a Windows CMD prompt or a Linux Shell; I actually prefer it over the Windows GUI and over a KDE or Gnome on Linux. I can generally get more done in a few keystrokes then mouse clicks, especially when you need to start a task and have a log of the outcome.</p>
<p><span id="more-165"></span>Some things the GUI is great for like exploring a file structure. Many times you are browsing the GUI and realize you need to drop to a command prompt to start a task. Rather than clicking &#8216;Start&#8217;, then &#8216;Run&#8217;, typing &#8216;CMD enter&#8217; and then changing directory, it would be nice to right click and drop to a CMD prompt from the Windows context menu.</p>
<a href="http://www.bohack.com/wp-content/uploads/2008/12/screenshot078.jpg"  rel="lightbox[165]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/2008/12/screenshot078.jpg" alt="Command Prompt Anywhere" title="Command Prompt Anywhere" width="300" height="300" class="alignnone size-medium wp-image-167" /></a>
<p>I have been using this little crafted registry hack for years now. There are two needs for a command prompt one is right clicking on a file  or other object and the other is right clicking on a folder. The &#8216;Command Prompt Anywhere.reg&#8217; below takes care of both instances. The first part edits the default context menu so that the &#8216;CommandPrompt&#8217; shows up for files and objects not defined as a folder. The second part edits the folder context menu so that &#8216;CommandPrompt&#8217; shows for folders.</p>
<p>There is one limitation It will not work for network locations, this is a limitation of using the &#8216;cd&#8217; command and can be changed using the &#8216;pushd&#8217; command. The &#8216;pushd&#8217; command will temporarily map the network location to the first drive letter available starting from &#8216;Z&#8217; and working backwards in the alphabet. However if the &#8216;cd&#8217; command in the scripts is replaced with &#8216;pushd&#8217; you will need to keep the network mappings tidy, by using either a &#8216;net use z: /d&#8217; or &#8216;popd&#8217; before you exit the prompt.</p>
<pre>
Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\*\shell]

[HKEY_CLASSES_ROOT\*\shell\CommandPrompt]

[HKEY_CLASSES_ROOT\*\shell\CommandPrompt\Command]
@="cmd.exe /k cd \"%1/..\""

[HKEY_CLASSES_ROOT\Directory\shell]

[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt]

[HKEY_CLASSES_ROOT\Directory\shell\CommandPrompt\Command]
@="cmd.exe /k cd \"%1\""
</pre>
<p>To install just copy and paste it to a file called &#8216;Command Prompt Anywhere.reg&#8217;,Â  then double click it and answer &#8216;yes&#8217; to the warning.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2008/12/command-prompt-anywhere/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Redirect HTTP to SSL with IIS</title>
		<link>http://www.bohack.com/2008/12/redirect-http-to-ssl-with-iis/</link>
		<comments>http://www.bohack.com/2008/12/redirect-http-to-ssl-with-iis/#comments</comments>
		<pubDate>Sun, 07 Dec 2008 17:58:09 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[IIS]]></category>
		<category><![CDATA[Redirection]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=141</guid>
		<description><![CDATA[It has become culture to prepend the http:// prefix in front of a URL. In fact if you type the URL in most web browsers and hit ctrl-enter, the browser will prepend the http:// in front of the URL. The HTTP (Hypertext Transfer Protocol) works on port 80 TCP and is defined in RFC 2616. [...]]]></description>
			<content:encoded><![CDATA[<p>It has become culture to prepend the http:// prefix in front of a URL. In fact if you type the URL in most web browsers and hit ctrl-enter, the browser will prepend the http:// in front of the URL. The HTTP (Hypertext Transfer Protocol) works on port 80 TCP and is defined in RFC 2616. Since HTTP language is clear text over port 80 TCP that means that forms authentication will travel over clear text and can be intercepted. So it is recommended that HTTPS (Hypertext Transfer Protocol over Secure Socket Layer) be used to encrypt the session with SSL. HTTPS or SSL works over port 443 TCP and requires a private certificate be installed from a browser trusted Certificate Authority (out of the scope of this article).</p>
<p><span id="more-141"></span> When you install Microsoft IIS, it defaults the first web site called &#8220;Default Web Site&#8221; to Port 80 and listens for HTTP requests on all assigned IPs. Sometime we need to install an application that requires SSL or we have chosen to require all communications be encrypted with SSL for the web application. IIS can be told to &#8220;Require Secure Channel (SSL)&#8221; and refuse all HTTP or non-SSL traffic; however it is culture to prepend the HTTP. So a redirection is needed from the HTTP request to an HTTPS request or Port 80 TCP to Port 443 TCP.</p>
<p>In my example, the server I installed uses a self-signed cert that was generated using the IIS Resource Kit 6 tool SelfSSL. On your site you may choose to use a public CA or internal CA trusted by your browser. So the first step is to install your application and install a Certificate through the &#8220;Directory Security&#8221; tab of the web site&#8217;s properties. On the Directory Security tab find the section titled &#8220;Secure Communications&#8221; and click &#8220;Edit&#8221;; you will then see the &#8220;Require Secure Channel (SSL)&#8221; option (see figure below).</p>
<a href="http://www.bohack.com/wp-content/uploads/2008/12/secure-communications-properties.jpg"  rel="lightbox[141]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/photojar/cache/secure-communications-properties-300x300-0-img143.jpg" alt="IIS Secure Communications Dialog Box" title="secure-communications-properties" width="300" height="283" class="alignnone size-medium wp-image-143" /></a>
<p>Once this is selected the site will return &#8220;HTTP Error 403.4 &#8211; Forbidden: SSL is required to view this resource. Internet Information Services (IIS)&#8221;, if clear text is used; not the most friendly error for your users.</p>
<a href="http://www.bohack.com/wp-content/uploads/2008/12/403-error.jpg"  rel="lightbox[141]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/photojar/cache/403-error-300x300-0-img145.jpg" alt="HTTP Error 403.4 - Forbidden: SSL is required to view this resource." title="403.4-error" width="279" height="300" class="alignnone size-medium wp-image-145" /></a>
<p>To solve this simple problem we will create a new web site that listens only for HTTP on port 80 TCP and redirects to the URL via HTTPS on port 443 TCP. You will need to re-assign an unused port number to the SSL site and you still need a directory to point the new site to.</p>
<p>Step 1 &#8211; Right click on your original site and click &#8220;Properties&#8221; then click on the &#8220;Web Site Tab&#8221;. Change the &#8220;TCP Port&#8221; under &#8220;Web Site Identification&#8221; to an unused port like 8080.</p>
<a href="http://www.bohack.com/wp-content/uploads/2008/12/web-site-identification.jpg"  rel="lightbox[141]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/photojar/cache/web-site-identification-300x300-0-img150.jpg" alt="Web Site Identification Dialog Box" title="web-site-identification" width="300" height="282" class="alignnone size-medium wp-image-150" /></a>
<p>Step 2 &#8211; Create a &#8220;redirection&#8221; file folder under c:\inetpub or your root web files. I usually create a file that describes not to ever delete the folder. You need to create this folder, because your redirection site needs to point to a folder even if it is not going to use it.</p>
<a href="http://www.bohack.com/wp-content/uploads/2008/12/placeholder-directory.jpg"  rel="lightbox[141]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/photojar/cache/placeholder-directory-300x300-0-img151.jpg" alt="Redirection Website Place Holder Directory" title="placeholder-directory" width="300" height="213" class="alignnone size-medium wp-image-151" /></a>
<p>Step 3 &#8211; Create the &#8220;Redirection&#8221; Web Site by right clicking &#8220;Web Sites&#8221; in the MMC and selecting &#8220;New&#8221; then &#8220;Web Site&#8221; from the context menu. Follow the wizard and name it &#8220;Redirection&#8221; and point it to the directory created in Step 2; assume all defaults.</p>
<a href="http://www.bohack.com/wp-content/uploads/2008/12/redirection-web-site.jpg"  rel="lightbox[141]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/2008/12/redirection-web-site.jpg" alt="Redirection Web Site" title="redirection-web-site" width="300" height="300" class="alignnone size-medium wp-image-152" /></a>
<p>StepÂ  4 &#8211; Right click the web site created in Step 3 and select &#8220;Properties&#8221; from the context menu, then select the &#8220;Home Directory&#8221; tab. From this tab you will click on &#8220;A Redirection to a URL&#8221; then type in your redirection URL of HTTPS://www.bohack.com.</p>
<a href="http://www.bohack.com/wp-content/uploads/2008/12/home-directory-redirection.jpg"  rel="lightbox[141]"  class="lightbox"><img src="http://www.bohack.com/wp-content/uploads/photojar/cache/home-directory-redirection-300x300-0-img153.jpg" alt="Home Directory Dialog Box" title="home-directory-redirection" width="294" height="300" class="alignnone size-medium wp-image-153" /></a>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2008/12/redirect-http-to-ssl-with-iis/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Windows Version of the Linux / UNIX &#8216;which&#8217; Command</title>
		<link>http://www.bohack.com/2008/11/windows-version-of-the-linux-which-command/</link>
		<comments>http://www.bohack.com/2008/11/windows-version-of-the-linux-which-command/#comments</comments>
		<pubDate>Mon, 24 Nov 2008 19:38:26 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Linux / Unix]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=137</guid>
		<description><![CDATA[During the day I always have a command window open on my desktop. It helps get simple tasks done; like reseting a password for a user or opening an ssh session with a remote box. I have a multitude of Windows command or cmd scripts that help me through out the day. Often I may [...]]]></description>
			<content:encoded><![CDATA[<p>During the day I always have a command window open on my desktop. It helps get simple tasks done; like reseting a password for a user or opening an ssh session with a remote box. I have a multitude of Windows command or cmd scripts that help me through out the day. Often I may want to change or tweak a script and then the hunt is on&#8230; Which directory was it created in? I know that it is in the path; because I can just execute it without typing it&#8217;s full path, but where is it?</p>
<p><span id="more-137"></span><br />
As best practice; I recommend to keep all scripts in a folder at the base of the %systemdrive% or C: drive and include it in your system %path% variable. This makes it easy to take your tools with you, when you redo your laptop or desktop. I personally use a folder called &#8216;sys&#8217;, but you can select your own. Just be sure to include the folder in your %path% variable.</p>
<p>Even if you put all your files in a particular folder sometimes your just looking for that particular file in the path. So I have written a Windows version of the UNIX &#8216;which&#8217; command. Just copy the script below and save it as &#8216;which.cmd&#8217; in your &#8216;sys&#8217; folder.</p>
<p>Copy and Paste the script below into notepad and save it as &#8220;which.cmd&#8221;</p>
<pre>
@echo off
rem /
rem / which.cmd - 110108 - bohack.com 2008iÂ Â Â Â  /
rem / Windows version of the UNIX which command /
rem /
setlocal
if [%1]==[] goto :errhand
set whichpath=%~dp$path:1
if [%whichpath%]==[] goto :end
echo %whichpath%%1
goto end

:errhand
echo.
echo Usage: %0 (filename to search in path)

:end
endlocal
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2008/11/windows-version-of-the-linux-which-command/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Server Ping and Reboot Monitor</title>
		<link>http://www.bohack.com/2008/11/simple-server-ping-and-reboot-monitor/</link>
		<comments>http://www.bohack.com/2008/11/simple-server-ping-and-reboot-monitor/#comments</comments>
		<pubDate>Mon, 17 Nov 2008 01:36:54 +0000</pubDate>
		<dc:creator>Bohack</dc:creator>
				<category><![CDATA[Windows]]></category>
		<category><![CDATA[Script]]></category>

		<guid isPermaLink="false">http://www.bohack.com/?p=131</guid>
		<description><![CDATA[I think we have all rebooted a server and then asked ourselves &#8220;Did it actually reboot?&#8221;. So we hunt through the logs for the event and then move on or reboot it again. During patch day for the servers this can be a real nag, knowing when something is back online so you can finish [...]]]></description>
			<content:encoded><![CDATA[<p>I think we have all rebooted a server and then asked ourselves &#8220;Did it actually reboot?&#8221;. So we hunt through the logs for the event and then move on or reboot it again. During patch day for the servers this can be a real nag, knowing when something is back online so you can finish patching it; is key to getting the job done. So I wrote this little batch script a while ago to help keep track.</p>
<p><span id="more-131"></span></p>
<p>Once it&#8217;s started via the command of &#8216;pingmon servername&#8217;. It will echo the time it started monitoring, then the alive time of a successful ping back. Once the host goes dead, it will echo the time it went dead or lost ping. Then it will echo the time it has gone alive again and quit. Simple batch script with one purpose, to make the administrator&#8217;s life simple.</p>
<p>Just copy and paste the script below into notepad and save it as &#8220;pingmon.cmd&#8221;</p>
<pre>@echo off

rem Bohack - pingmon.cmd - 2002i

set ipname=%1

if {%ipname%}=={} (GOTO :errhand)

set /a calive=0
set /a cdead=0
set /a cexit=0

echo.
echo.
echo Monitoring %ipname%
echo.
echo ** Started %date% - %time%
echo.

:loop

FOR /F â€œskip=3 tokens=1,2*â€ %%a IN (â€™ping -n 1 %ipname%â€™) DO CALL :checkdo %%a
if %cexit% EQU 1 (goto :mend)

goto :loop

:checkdo

set reply=%1
if {%reply%}=={} (goto :end)
set replytruc=%reply:~0,5%
if /I {%replytruc%}=={Reply} (goto :alive)
if /I {%replytruc%}=={Reque} (goto :dead)
goto :end

:alive

if %calive% EQU 0 (echo ** Alive %date% - %time%)
set /a calive=1
if %cdead% GTR 0 (echo ** Alive %date% - %time%) &amp; (set /a cexit=1)

goto :end

:dead

if %cdead% LSS 1 (echo ** DeadÂ  %date% - %time%)
set /a cdead=1

goto :end

:errhand

echo.
echo.
echo Usage PingMon {computer or IP}

:mend

echo.
echo.

:end</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.bohack.com/2008/11/simple-server-ping-and-reboot-monitor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
