<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet type="text/xsl" href="https://shazwazza.com/rss/xslt"?>
<rss xmlns:a10="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Shazwazza</title>
    <link>https://shazwazza.com/</link>
    <description>My blog which is pretty much just all about coding</description>
    <generator>Articulate, blogging built on Umbraco</generator>
    <image>
      <url>/media/0libq25y/frog.png?rmode=max&amp;v=1da0e911f4e6890</url>
      <title>Shazwazza</title>
      <link>https://shazwazza.com/</link>
    </image>
    <item>
      <guid isPermaLink="false">1264</guid>
      <link>https://shazwazza.com/post/deploying-to-azure-from-vsts-using-publish-profiles-and-msdeploy/</link>
      <category>Web Development</category>
      <category>etc...</category>
      <category>Hosting</category>
      <category>Servers</category>
      <title>Deploying to Azure from VSTS using publish profiles and msdeploy</title>
      <description>&lt;p&gt;In almost all of the examples online about how to deploy various services to Azure, they always list the super easy way to do it and that is to authenticate your current account to your Azure subscription which then grants your VSTS build to do all sorts of things… The problem is that not everyone has the security clearance to use the super easy tools in VSTS.&lt;/p&gt;&lt;p&gt;When you attempt to use these nice tools in VSTS you might get an error like this: &lt;font color="#f79646"&gt;“Failed to set Azure permission ‘RoleAssignmentId: some-guid-goes-here’ for the service principal … does not have authorizationto perform action ‘Microsoft.Authorization/roleAssignments/write’ over scope”&lt;/font&gt; This is because these nice VSTS tools actually creates a custom user behind the scenes in your azure subscription to use but your account doesn’t have access to authorize that.&lt;/p&gt;&lt;p&gt;Luckily there’s a work around&lt;/p&gt;&lt;h2&gt;MS Deploy … sigh&lt;/h2&gt;&lt;p&gt;Maybe there are other work arounds but this works, however it’s not the most elegant. I thought I’d post my findings here because it was a bit of a pain in the ass to get this all correct.&lt;/p&gt;&lt;p&gt;So here’s the steps:&lt;/p&gt;&lt;h3&gt;1. Download the publish profile&lt;/h3&gt;&lt;p&gt;You need to get the publish profile from your app service that you want to deploy to. This can be a website, a staging slot, an Azure function, (probably a bunch of others)&lt;/p&gt;&lt;p&gt;&lt;a href="https://shazwazza.com/media/articulate/open-live-writer-deploying-to-azure_ead7-image_2.png"&gt;&lt;img width="600" height="185" title="image" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" alt="image" src="https://shazwazza.com/media/articulate/open-live-writer-deploying-to-azure_ead7-image_thumb.png" border="0"&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;The file downloaded is an XML file containing a bunch of info you’ll need&lt;/p&gt;&lt;h3&gt;2. Create a release definition and environment for your deployment&lt;/h3&gt;&lt;p&gt;&lt;em&gt;This assumes that you are pretty familiar with VSTS&lt;/em&gt;&lt;/p&gt;&lt;p&gt;You’ll want to create an empty environment in your release definition. Normally this is where you could choose the built in fancy VSTS deployment templates like “Azure App Service Deployment” … but as above, this doesn’t work if you don’t have security clearance. Instead, choose ‘Empty’&lt;/p&gt;&lt;p&gt;&lt;a href="https://shazwazza.com/media/articulate/open-live-writer-deploying-to-azure_ead7-image_4.png"&gt;&lt;img width="600" height="330" title="image" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" alt="image" src="https://shazwazza.com/media/articulate/open-live-writer-deploying-to-azure_ead7-image_thumb_1.png" border="0"&gt;&lt;/a&gt;&lt;/p&gt;&lt;p&gt;Then in your environment tasks, add Batch Script&lt;/p&gt;&lt;p&gt;&lt;a href="https://shazwazza.com/media/articulate/open-live-writer-deploying-to-azure_ead7-image_6.png"&gt;&lt;img width="600" height="312" title="image" style="border: 0px currentcolor; border-image: none; display: inline; background-image: none;" alt="image" src="https://shazwazza.com/media/articulate/open-live-writer-deploying-to-azure_ead7-image_thumb_2.png" border="0"&gt;&lt;/a&gt;&lt;/p&gt;&lt;h3&gt;3. Setup your batch script&lt;/h3&gt;&lt;p&gt;There’s 2 ways to go about this and both depend on a msdeploy build output. This build output is generated by your build in VSTS if you are using a standard VSTS Visual Studio solution build. This will create msdeploy packages for you and will have put them in your artifacts folder. Along with msdeploy packages this will also generate a cmd batch file that executes msdeploy and a readme file to tell you how to execute it which contains some important info that you should read.&lt;/p&gt;&lt;p&gt;So here’s 2 options: Execute the cmd file, or execute msdeploy.exe directly&lt;/p&gt;&lt;h2&gt;Execute the cmd file&lt;/h2&gt;&lt;p&gt;There’s a bit of documentation about this online but most of it is based on using the SetParameters.xml file to adjust settings… but i just don’t want to use that. &lt;/p&gt;&lt;p&gt;Here’s the Path and Arguments that you need to run:&lt;/p&gt;


&lt;pre class="language-batch"&gt;&lt;code&gt;$(System.DefaultWorkingDirectory)/YOUR_BUILD_NAME/drop/YOUR_MSBUILD_PACKAGE.deploy.cmd&lt;/code&gt;&lt;/pre&gt;
&lt;pre class=" language-batch"&gt;&lt;code&gt;/y "/m:https://${publishUrl}/MSDeploy.axd?site=${msdeploySite}" /u:$(userName) /p:$(userPWD) /a:Basic -enableRule:DoNotDeleteRule "-setParam:name='IIS Web Application Name',value='${msdeploySite}'"

&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The parameters should be added to your VSTS Variables: ${msdeploySite}, $(userName), $(userPWD) and these variables correspond exactly to what is in your publish profile XML file that you downloaded. These parameters need to be pretty much exact, any misplaced quote or if you don’t include https, etc… will cause this to fail.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Important&lt;/strong&gt;: the use of &lt;strong&gt;-enableRule:DoNotDeleteRule&lt;/strong&gt; is totally optional, if you want to reset your site to exactly what is in the msdeploy package you do not want this. If however, you have user generated images, content or custom config files that exist on your site and you don’t want them deleted when you deploy, then you need to set this.&lt;/p&gt;&lt;p&gt;I’m unsure if this will work for Azure Functions deployment (it might!) … but I used the next option to do that:&lt;/p&gt;&lt;h2&gt;Execute msdeploy.exe directly&lt;/h2&gt;&lt;p&gt;If you execute the CMD file, you’ll see in the VSTS logs the exact msdeploy signature used which is:&lt;/p&gt;
&lt;pre class="language-batch"&gt;&lt;code&gt;"C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe" -source:package='d:\a\r1\a\YOUR_PROJECT_NAME\drop\YOUR_MSDEPLOY_PACKAGE_FILE.zip' -dest:auto,computerName="https://YOUR_PUBLISH_URL/MSDeploy.axd?site=YOUR_PROFILE_NAME",userName=********,password=********,authtype="Basic",includeAcls="False" -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:"d:\a\r1\a\YOUR_PROJECT_NAME\drop\YOUR_MSDEPLOY_PACKAGE_FILE.SetParameters.xml" -enableRule:DoNotDeleteRule -setParam:name='IIS Web Application Name',value='YOUR_PROFILE_NAME'&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;So if you wanted, you could take this and execute that directly instead of the CMD file. I use this method to deploy Azure Functions but the script is a little simpler since that deployment doesn’t require all of these parameters. For that I use this for the Path and Arguments:&lt;/p&gt;
&lt;pre class="language-batch"&gt;&lt;code&gt;C:\Program Files\IIS\Microsoft Web Deploy V3\msdeploy.exe&lt;/code&gt;&lt;/pre&gt;


&lt;pre class="language-batch"&gt;&lt;code&gt;-verb:sync -source:package='$(System.DefaultWorkingDirectory)/YOUR_BUILD_NAME/drop/YOUR_MSDEPLOY_PACKAGE.zip' -dest:auto,computerName="https://$(publishUrl)/msdeploy.axd?site=$(msdeploySite)",UserName='$(userName)',Password='$(userPWD)',AuthType='Basic' -setParam:name='IIS Web Application Name',value='$(msdeploySite)'&lt;/code&gt;&lt;/pre&gt;


&lt;p&gt;&lt;br&gt;&lt;/p&gt;&lt;p&gt;Hopefully this comes in handy for someone &lt;img class="wlEmoticon wlEmoticon-winkingsmile" alt="Winking smile" src="https://shazwazza.com/media/articulate/open-live-writer-deploying-to-azure_ead7-wlemoticon-winkingsmile_2.png"&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 23 Mar 2023 15:08:44 Z</pubDate>
      <a10:updated>2023-03-23T15:08:44Z</a10:updated>
    </item>
    <item>
      <guid isPermaLink="false">1267</guid>
      <link>https://shazwazza.com/post/guide-to-installing-cold-fusion-8-on-windows-server-2008-iis-7-64-bit/</link>
      <category>etc...</category>
      <category>Hosting</category>
      <category>Servers</category>
      <title>Guide to installing Cold Fusion 8 on Windows Server 2008 (IIS 7) 64 bit</title>
      <description>&lt;div class="imported-post"&gt;This post was imported from FARMCode.org which has been discontinued. These posts now exist here as an archive. They may contain broken links and images.&lt;/div&gt;
After a lot of trial and error i finally figured out how to get CF 8 running in on Windows Server 2008 x64 in IIS 7. So i figured I&amp;rsquo;d write a post about it since there&amp;rsquo;s pretty much no documentation covering this that i could find.
&lt;/p&gt;
&lt;h2&gt;Installation&lt;/h2&gt;  
&lt;ul&gt;
	&lt;li&gt;Take a backup of IIS      
	&lt;ul&gt;
		&lt;li&gt;C:\Windows\System32\Inetsrv\AppCmd add backup &amp;quot;backupname&amp;quot; &lt;/li&gt;     
	&lt;/ul&gt;
	&lt;/li&gt;    
	&lt;li&gt;Install CF 8 Enterprise      
	&lt;ul&gt;
		&lt;li&gt;Select Multiserver &lt;/li&gt;        
		&lt;li&gt;Keep default paths &lt;/li&gt;        
		&lt;li&gt;DO NOT attempt to configure anything for ColdFusion until the update is applied &lt;/li&gt;     
	&lt;/ul&gt;
	&lt;/li&gt;    
	&lt;li&gt;Install CF 8.1 Update      
	&lt;ul&gt;
		&lt;li&gt;Configure for Multiserver &lt;/li&gt;     
	&lt;/ul&gt;
	&lt;/li&gt; 
&lt;/ul&gt;
&lt;h2&gt;Web Site/Server Configuration&lt;/h2&gt;  
&lt;ul&gt;
	&lt;li&gt;Give the IIS users/groups (IUSR, IIS_IUSRS) full control over your JRun install folder (C:\JRun4\lib\wsconfig)      
	&lt;ul&gt;
		&lt;li&gt;After looking at the logs, it seems that the configuration tool is trying to set IIS_WPG permissions on this folder which is for Server 2003, not 2008 &lt;/li&gt;     
	&lt;/ul&gt;
	&lt;/li&gt;    
	&lt;li&gt;Create a new application pool called ColdFusion      
	&lt;ul&gt;
		&lt;li&gt;Under advanced settings, enable running in 32 bit mode and make Managed Pipeline mode Classic instead of Integrated &lt;/li&gt;        
		&lt;li&gt;CF will not run without 32 bit and Classic enabled (according to my experience so far) &lt;/li&gt;     
	&lt;/ul&gt;
	&lt;/li&gt;    
	&lt;li&gt;Create a new website and ensure it is assigned to the ColdFusion application pool      
	&lt;ul&gt;
		&lt;li&gt;For testing, create a website pointed to your default CFIDE install folder &lt;/li&gt;     
	&lt;/ul&gt;
	&lt;/li&gt;    
	&lt;li&gt;Launch the Web Server Configuration Tool from Start Menu      
	&lt;ul&gt;
		&lt;li&gt;Click Add &lt;/li&gt;        
		&lt;li&gt;Select &amp;quot;coldfusion&amp;quot; from the JRun Server drop down list (not &amp;quot;admin&amp;quot;) &lt;/li&gt;        
		&lt;li&gt;Ensure the Web Server has IIS selected &lt;/li&gt;        
		&lt;li&gt;Select the website you just created from the IIS Web Site drop down list (Do not check All, or be prepared to restore IIS if your running other .Net apps!) &lt;/li&gt;        
		&lt;li&gt;Check &amp;quot;Configure web server for ColdFusion 8 application&amp;quot; &lt;/li&gt;        
		&lt;li&gt;Click Advanced...          
		&lt;ul&gt;
			&lt;li&gt;Check Enable verbose logging for connector if you want details log requests for debugging &lt;/li&gt;         
		&lt;/ul&gt;
		&lt;/li&gt;        
		&lt;li&gt;Save changes and click yes to restart the web server (this will restart IIS!!!) &lt;/li&gt;     
	&lt;/ul&gt;
	&lt;/li&gt; 
&lt;/ul&gt;
&lt;h2&gt;Testing&lt;/h2&gt;  
&lt;ul&gt;
	&lt;li&gt;If you configured a test site to point to your CFIDE folder, go to the website in your browser to the /install.cfm path      
	&lt;ul&gt;
		&lt;li&gt;This should show you a Congratulations screen &lt;/li&gt;     
	&lt;/ul&gt;
	&lt;/li&gt;    
	&lt;li&gt;If you configured your site with your own CF files, test those instead &lt;/li&gt; 
&lt;/ul&gt;
&lt;h2&gt;Debugging&lt;/h2&gt;  
&lt;ul&gt;
	&lt;li&gt;After some trial and error, i figured out the above procedure, but there are logs to refer to. &lt;/li&gt;    
	&lt;li&gt;the CF web site config tool creates web site configuration structures at this location:      
	&lt;ul&gt;
		&lt;li&gt;\Run4\lib\wsconfig\(some number) &lt;/li&gt;        
		&lt;li&gt;Each (some number) corresponds to a different website configured with the tool &lt;/li&gt;        
		&lt;li&gt;In each folder is a LogFiles folder that contains logs that you can use to debug the installation &lt;/li&gt;     
	&lt;/ul&gt;
	&lt;/li&gt;    
	&lt;li&gt;There&amp;#39;s also a log file at: \Run4\lib\wsconfig\wsconfig.log &lt;/li&gt; 
&lt;/ul&gt;
&lt;h2&gt;Un-configuring a site&lt;/h2&gt;  
&lt;ul&gt;
	&lt;li&gt;If a site needs to be un-configured or re-configured, the web configuration tool seem to always fail when trying to remove a site. &lt;/li&gt;    
	&lt;li&gt;To remove a site manually:      
	&lt;ul&gt;
		&lt;li&gt;Stop the website in IIS &lt;/li&gt;        
		&lt;li&gt;Stop the CF server and CF admin services in the Services administration tools &lt;/li&gt;        
		&lt;li&gt;Delete the folder: \Run4\lib\wsconfig\(some number)          
		&lt;ul&gt;
			&lt;li&gt;where (some number) corresponds to the site you want to remove &lt;/li&gt;         
		&lt;/ul&gt;
		&lt;/li&gt;        
		&lt;li&gt;edit the \Run4\lib\wsconfig\wsconfig.properties file and remove the lines referring to the number (some number) of the site folder that you deleted in the previous step &lt;/li&gt;        
		&lt;li&gt;Start the CF admin and CF server services &lt;/li&gt;        
		&lt;li&gt;Run the web configuration tool and re-add the site you want configured &lt;/li&gt;        
		&lt;li&gt;Start the site in IIS &lt;/li&gt;     
	&lt;/ul&gt;
	&lt;/li&gt; 
&lt;/ul&gt;</description>
      <pubDate>Thu, 23 Mar 2023 15:08:14 Z</pubDate>
      <a10:updated>2023-03-23T15:08:14Z</a10:updated>
    </item>
    <item>
      <guid isPermaLink="false">1272</guid>
      <link>https://shazwazza.com/post/changing-the-hostname-of-a-sharepoint-site/</link>
      <category>etc...</category>
      <category>Hosting</category>
      <category>Servers</category>
      <title>Changing the hostname of a SharePoint site</title>
      <description>&lt;div class="imported-post"&gt;This post was imported from FARMCode.org which has been discontinued. These posts now exist here as an archive. They may contain broken links and images.&lt;/div&gt;We’ve recently set up a SharePoint server here at TheFARM which will run parts of our intranet and be our document management system.&lt;/p&gt;  &lt;p&gt;So it got installed, but the problem was that it was installed onto a machine called &lt;strong&gt;mars&lt;/strong&gt;. I made the obligatory jokes about ‘life on mars’ (admittedly I may have made the joke a few to many times :P) but at the end of last year we ran a competition to name the new intranet.&lt;/p&gt;  &lt;p&gt;There were some fun names like SkyNet, and Randall, but ultimately the winning entry was &lt;strong&gt;TheBarn, &lt;/strong&gt;which is very aptly farm-based.    &lt;br /&gt;But we had a problem, we don’t want to rename the server from mars (plus I’ve done that on SharePoint before, baaaaaaaaaaaaaaaaaaaaaaaaaaaaad idea), so how do you get SharePoint to accept &lt;a href="http://thebarn"&gt;http://thebarn&lt;/a&gt; when that’s not the machine name?&lt;/p&gt;  &lt;p&gt;Unlike standard standard sites in IIS just adding a host header isn’t going to work, SharePoint will redirect you to the one it knows about, so although we were coming in via &lt;a href="http://thebarn"&gt;http://thebarn&lt;/a&gt; we’d end up at &lt;a href="http://mars"&gt;http://mars&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Hmmm…&lt;/p&gt;  &lt;p&gt;Luckily it is actually very easy to do with SharePoint. SharePoint has the ability to Extend a web application:&lt;/p&gt;  &lt;p&gt;&lt;a href="/image.axd?picture=WindowsLiveWriter/ChangingthehostnameofaSharePointsite/50385B65/image.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/image.axd?picture=WindowsLiveWriter/ChangingthehostnameofaSharePointsite/5D9E6E6B/image_thumb.png" width="244" height="122" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;So you navigate here, choose the &lt;strong&gt;Extend an existing Web application&lt;/strong&gt;, select your site and enter the hostname (and set the port back to 80):&lt;/p&gt;  &lt;p&gt;&lt;a href="/image.axd?picture=WindowsLiveWriter/ChangingthehostnameofaSharePointsite/1FA4DDAD/image.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="/image.axd?picture=WindowsLiveWriter/ChangingthehostnameofaSharePointsite/746046A5/image_thumb.png" width="244" height="83" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Now you’ll have a SharePoint site which listens on your new host header. You can go and delete the old one if you want (&lt;strong&gt;Remove SharePoint from IIS Web site&lt;/strong&gt;) and then you’re done.&lt;/p&gt;</description>
      <pubDate>Thu, 23 Mar 2023 15:08:14 Z</pubDate>
      <a10:updated>2023-03-23T15:08:14Z</a10:updated>
    </item>
    <item>
      <guid isPermaLink="false">1158</guid>
      <link>https://shazwazza.com/post/testing-outgoing-smtp-emails-so-simple/</link>
      <category>Web Development</category>
      <category>etc...</category>
      <category>Hosting</category>
      <category>Servers</category>
      <title>Testing Outgoing SMTP Emails - So Simple!</title>
      <description>&lt;div class="imported-post"&gt;This post was imported from FARMCode.org which has been discontinued. These posts now exist here as an archive. They may contain broken links and images.&lt;/div&gt;At the &lt;a href="http://www.umbraco.org" target="_blank"&gt;Umbraco&lt;/a&gt; retreat before &lt;a href="http://www.codegarden09.com/" target="_blank"&gt;CodeGarden 09&lt;/a&gt; in Denmark, &lt;a href="http://www.aaron-powell.com/" target="_blank"&gt;Aaron&lt;/a&gt; had told me an extremely handy tip about testing outbound emails in your .Net applications. I'm not sure why I've never heard about this before and the funny thing is all of the .Net developers working in our office (including contractors) had never seen this before either! It's so incredibly simple and built into .Net, so if you don't know about this already you'll want to be using this in the future.&lt;/p&gt;  &lt;p&gt;If you application needs to send emails for whatever reason and you’re testing locally, you generally have to make sure that you're only sending emails to your address(es) so you’re not spamming a bunch of random people. This is an easy way to get around that and lets you view all of the emails sent. Just change (in our case add) a &lt;em&gt;deliveryMethod&lt;/em&gt; attribute to your &lt;em&gt;smtp&lt;/em&gt; settings to &lt;em&gt;SpecifiedPickupDirectory:&lt;/em&gt;&lt;/p&gt;  &lt;pre&gt;&amp;lt;system.net&amp;gt;
  &amp;lt;mailSettings&amp;gt;
    &amp;lt;smtp from=&amp;quot;noreply@localhost&amp;quot; deliveryMethod=&amp;quot;SpecifiedPickupDirectory&amp;quot;&amp;gt;
      &amp;lt;specifiedPickupDirectory pickupDirectoryLocation=&amp;quot;c:\maildrop&amp;quot; /&amp;gt;
    &amp;lt;/smtp&amp;gt;
  &amp;lt;/mailSettings&amp;gt;
&amp;lt;/system.net&amp;gt;&lt;/pre&gt;

&lt;p&gt;Now, all emails that are sent, just get saved to the specified folder and you can view them with Windows Live Mail, Outlook express, Thunderbird, or whatever.&lt;/p&gt;

&lt;p&gt;Nice!! &lt;/p&gt;</description>
      <pubDate>Thu, 23 Mar 2023 15:08:14 Z</pubDate>
      <a10:updated>2023-03-23T15:08:14Z</a10:updated>
    </item>
    <item>
      <guid isPermaLink="false">1203</guid>
      <link>https://shazwazza.com/post/tsql-case-statement-in-where-clause-for-not-in-or-in-filter/</link>
      <category>Web Development</category>
      <category>etc...</category>
      <category>Hosting</category>
      <category>Servers</category>
      <title>TSQL CASE statement in WHERE clause for NOT IN or IN filter</title>
      <description>&lt;div class="imported-post"&gt;This post was imported from FARMCode.org which has been discontinued. These posts now exist here as an archive. They may contain broken links and images.&lt;/div&gt;There’s a ton of articles out there on how to implement a case statement in a WHERE clause but couldn’t find one on how to implement a CASE statement in a WHERE clause that gives you the ability to use a NOT IN or IN filter. I guess the only way to explain this is to use an example, and I am fully aware that the use of this may not be the best practice and is most likely required because of poor database design/implementation but hey, when you inherit code, there’s really no other choice :)  &lt;p&gt;Suppose I have a stored proc that has an optional value:&lt;/p&gt; &lt;p&gt;@OnlyNonExported bit = 0&lt;/p&gt; &lt;p&gt;I want to return all items from MYTRANSACTIONS table if @OnlyNonExported&amp;nbsp; = 0, but if this value is 1 I want to return all items from MYTRANSACTIONS that have not been tracked in my TRACKEDTRANSACTIONS table. The original theory is to use a NOT IN clause to acheive the latter requirement:&lt;/p&gt;&lt;pre&gt;SELECT * FROM mytransactions m 
WHERE mytransactions.id NOT IN (SELECT id FROM trackedtransactions)&lt;/pre&gt;
&lt;p&gt;So if I wanted to use a case statement for this query, one would think you could do something like this:&lt;/p&gt;&lt;pre&gt;SELECT * FROM mytransactions m 
WHERE mytransactions.id NOT IN 
	CASE WHEN @OnlyNonExported = 0 
		THEN&amp;nbsp; (SELECT -1) 
		ELSE&amp;nbsp; (SELECT id FROM trackedtransactions) 
	END&lt;/pre&gt;
&lt;p&gt;But SQL doesn’t like this syntax and it turns out that you cannot use IN or NOT IN conditions with CASE statement in a WHERE clause, you can only use = or != conditions. So how do you achieve the above? Well the answer is even more dodgy that the above:&lt;/p&gt;&lt;pre&gt;SELECT * FROM mytransactions m 
WHERE mytransactions.id != 
	CASE WHEN @OnlyNonExported = 0 
		THEN&amp;nbsp; (SELECT -1) 
		ELSE&amp;nbsp; COALESCE((SELECT id FROM trackedtransactions t WHERE t.id = m.id), -1)
	END&lt;/pre&gt;
&lt;p&gt;So basically, when we want to return all transactions, return all rows where the id equals –1 (assuming that your IDs start at 1) and when we want to filter the results based on whether or not these IDs exist in another table, we only return rows who’s IDs don’t match the same ID in the tracked table. BUT if this ID doesn’t exist in the tracked table, then an empty result set is returned and the id won’t be matched against it, so we need a COALESCE function will will return a –1 value if there is an empty result set.&lt;/p&gt;
&lt;p&gt;Hopefully you’ll never have to use this but if you do, hope this saves you some headaches :)&lt;/p&gt;</description>
      <pubDate>Thu, 23 Mar 2023 15:08:14 Z</pubDate>
      <a10:updated>2023-03-23T15:08:14Z</a10:updated>
    </item>
    <item>
      <guid isPermaLink="false">1246</guid>
      <link>https://shazwazza.com/post/wildcard-mapping-in-iis-7-classic-pipeline-webconfig/</link>
      <category>Web Development</category>
      <category>etc...</category>
      <category>Hosting</category>
      <category>Servers</category>
      <title>Wildcard mapping in IIS 7 classic pipeline = web.config!</title>
      <description>&lt;div class="imported-post"&gt;This post was imported from FARMCode.org which has been discontinued. These posts now exist here as an archive. They may contain broken links and images.&lt;/div&gt;After foolishly pulling out my hair trying to find out why my wildcard mapping was disappearing in IIS 7 using classic pipeline mode, i realized it was my own fault!! I followed the instructions on this site: &lt;a title="http://learn.iis.net/page.aspx/508/wildcard-script-mapping-and-iis-7-integrated-pipeline/" href="http://learn.iis.net/page.aspx/508/wildcard-script-mapping-and-iis-7-integrated-pipeline/"&gt;http://learn.iis.net/page.aspx/508/wildcard-script-mapping-and-iis-7-integrated-pipeline/&lt;/a&gt; and unfortunately just skipped over the message about how this modifies your web.config… oops! So basically, every time I deployed my handler mapping would be removed… Doh!&lt;/p&gt;  &lt;p&gt;Unfortunately, the method to add a wildcard mapping in this article will actually remove the inheritance of standard handlers from the root of IIS and your machine.config and just make copies of them. This might not be the best approach, but i suppose sometimes it’s necessary. We only need the wildcard mapping for URL Rewriting so i decided to see if i could just simply add the isapi wildcard mapping only, have the rest of the handlers inherit from the root and see if it works… turns out it does!&lt;/p&gt;  &lt;p&gt;So instead of having to modify IIS itself, i just needed to add this to my web.config:&lt;/p&gt;  &lt;pre&gt;&amp;lt;handlers&amp;gt;
	&amp;lt;remove name=&amp;quot;ASP.Net-ISAPI-Wildcard&amp;quot; /&amp;gt;
	&amp;lt;add name=&amp;quot;ASP.Net-ISAPI-Wildcard&amp;quot; path=&amp;quot;*&amp;quot;
	verb=&amp;quot;*&amp;quot; type=&amp;quot;&amp;quot; modules=&amp;quot;IsapiModule&amp;quot;
	scriptProcessor=&amp;quot;C:\Windows\Microsoft.NET\Framework64\v2.0.50727\aspnet_isapi.dll&amp;quot;
	resourceType=&amp;quot;Unspecified&amp;quot;
	requireAccess=&amp;quot;None&amp;quot;
	allowPathInfo=&amp;quot;false&amp;quot;
	preCondition=&amp;quot;classicMode,runtimeVersionv2.0,bitness64&amp;quot;
	responseBufferLimit=&amp;quot;4194304&amp;quot; /&amp;gt;
&amp;lt;/handlers&amp;gt;&lt;/pre&gt;

&lt;p&gt;Too easy! No fussing around with IIS and now at least i won’t override my changes accidentally.&lt;/p&gt;</description>
      <pubDate>Thu, 23 Mar 2023 15:08:14 Z</pubDate>
      <a10:updated>2023-03-23T15:08:14Z</a10:updated>
    </item>
    <item>
      <guid isPermaLink="false">1215</guid>
      <link>https://shazwazza.com/post/importing-svn-to-mercurial-with-complex-svn-repository/</link>
      <category>etc...</category>
      <category>Hosting</category>
      <category>Servers</category>
      <title>Importing SVN to Mercurial with complex SVN repository</title>
      <description>&lt;div class="imported-post"&gt;This post was imported from FARMCode.org which has been discontinued. These posts now exist here as an archive. They may contain broken links and images.&lt;/div&gt;Here @ &lt;a href="http://thefarmdigital.com.au" target="_blank"&gt;TheFARM&lt;/a&gt;, we’ve been moving across to Mercurial (on &lt;a href="http://bitbucket.org" target="_blank"&gt;BitBucket&lt;/a&gt;) for our code repositories. In many cases our SVN repositories are structured ‘normally’:  &lt;ul&gt; &lt;li&gt;trunk  &lt;li&gt;tags  &lt;li&gt;branches &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Using the ‘hg convert’ command line, when your SVN repository is structured this way will import your trunk into the Mercurial ‘default’ branch and your branches/tags into named branches. This also imports all history and revisions. From there, you can merge as you wish to structure your Mercurial repository the way that you want.&lt;/p&gt; &lt;p&gt;However, in some cases we have more complicated repositories. An example of this is a structure like the following:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;trunk  &lt;ul&gt; &lt;li&gt;DotNet  &lt;li&gt;Flash &lt;/li&gt;&lt;/ul&gt; &lt;li&gt;tags  &lt;li&gt;branches  &lt;ul&gt; &lt;li&gt;v1.1-DotNet  &lt;li&gt;v1.2-Flash &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;In the above structure, we’ve actually branched the trunk/DotNet &amp;amp; trunk/Flash folders separately into their own branches. Unfortunately, Mercurial doesn’t operate this way so it doesn’t really understand creating branches from folders. There’s a couple different ways that you can get this from SVN into Mercurial whilst maintaining all of your history…&lt;/p&gt; &lt;p&gt;One way is to run ‘hg convert’ on the entire repository. You’ll end up with 3 branches in Mercurial: &lt;em&gt;default&lt;/em&gt;, &lt;em&gt;v1.1-DotNet &lt;/em&gt;&amp;amp; &lt;em&gt;v1.2-Flash&lt;/em&gt;. The problem is that if you try to merge the named branches into default, you’ll end up with a mess since the branches don’t have the same folder structure as default. To overcome this, you can restructure each named branch to follow the same folder structure as &lt;em&gt;default&lt;/em&gt;. To do this, we us the ‘rename’ method on Tortoise Hg. So for instance, if we had this folder structure inside of &lt;em&gt;v1.1-DotNet&lt;/em&gt;:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;BuildFiles  &lt;li&gt;MyProject.Web  &lt;li&gt;MyProject.Config &lt;/li&gt;&lt;/ul&gt; &lt;p&gt;So that we can merge this with &lt;em&gt;default &lt;/em&gt;we need to restructure this into:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;DotNet  &lt;ul&gt; &lt;li&gt;BuildFiles  &lt;li&gt;MyProject.Web  &lt;li&gt;MyProject.Config &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;So we just need to right click each folder seperately, and select the rename option from the Tortoise Hg sub menu:&lt;/p&gt; &lt;p&gt;&lt;a href="/image.axd?picture=image_8.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/image.axd?picture=image_thumb_8.png" width="345" height="233"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Then we prefix the folder name with the new folder location which will the ‘move’ the file:&lt;/p&gt; &lt;p&gt;&lt;a href="/image.axd?picture=image_9.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/image.axd?picture=image_thumb_9.png" width="210" height="145"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;Now that the named branch &lt;em&gt;v1.1-DotNet&lt;/em&gt; is in the same folder structure as &lt;em&gt;default&lt;/em&gt;, we can perform a merge.  &lt;p&gt;The other way to import a complicated SVN structure to mercurial is to convert individual branches to mercurial repositories one by one. The first thing you’ll need to do is run an ‘hg convert’ on the Trunk of your SVN repository. This will create your new ‘master’ mercurial repository for which will push the other individual mercurial repositories in to. Next, run an ‘hg convert’ on each of your SVN branches. For example: &lt;em&gt;hg convert svn://my.svn.server.local/MyProject/Branches/v1.1-DotNet. &lt;/em&gt;&lt;/p&gt; &lt;p&gt;Once you have individual repositories for your branches, we can force push these into your ‘master’ repository. To do a merge of these branches, the above procedure will still need to be followed to ensure your branches have the same folder structure as &lt;em&gt;default&lt;/em&gt;. HOWEVER, because we’ve forced pushed changesets into Mercurial, it has no idea how these branches relate to each other (in fact, it gives you warnings about this when you force push). When you try to do a merge, you’ll end up getting conflict warnings for every file that exists in both locations since Mercurial doesn’t know which one is newer/older. This can be a huge pain in the arse, especially if you have tons of files. If we assume that the branch files are the most up to date and we just want to replace the files in &lt;em&gt;default, &lt;/em&gt;then there’s a fairly obscure way to do that. In the merge dialog, you’ll need to select the option “internal : other” from the list of Merge tools:&lt;/p&gt; &lt;p&gt;&lt;a href="/image.axd?picture=image_10.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="/image.axd?picture=image_thumb_10.png" width="530" height="76"&gt;&lt;/a&gt;&lt;/p&gt; &lt;p&gt;This tells Mercurial that for any conflict you want to use the ‘other’ revision (which is your branch revision since you should have &lt;em&gt;default&lt;/em&gt; checked out to do the merge).&lt;/p&gt;  &lt;p&gt;We’ve had success with both of these options for converting SVN to Mercurial and maintaining our history. &lt;/p&gt;</description>
      <pubDate>Thu, 23 Mar 2023 15:08:09 Z</pubDate>
      <a10:updated>2023-03-23T15:08:09Z</a10:updated>
    </item>
    <item>
      <guid isPermaLink="false">1301</guid>
      <link>https://shazwazza.com/post/automated-website-deployment-with-powershell-and-smartftp/</link>
      <category>etc...</category>
      <category>Hosting</category>
      <category>Servers</category>
      <title>Automated website deployment with PowerShell and SmartFTP</title>
      <description>&lt;div class="imported-post"&gt;This post was imported from FARMCode.org which has been discontinued. These posts now exist here as an archive. They may contain broken links and images.&lt;/div&gt;SmartFTP is a fantastic FTP application which handles syncing files very effectively. This means that when you upload your entire website, SmartFTP will automatically detect changes and only upload what is required (instead of overwriting all of the files like some FTP applications do). For each project at TheFARM we have build scripts which run and create a time stamped ZIP package for each deployment environment with all of the necessary files formatted appropriately for each. Our deployment process then involves unzipping the contents of this file, opening up SmartFTP, connecting to the deployment destination and transfering all of the deployment files up (which SmartFTP synchronizes for us).  &lt;p&gt;I thought it would be much more efficient if we automated this process. So we did some investigation and it turns out the SmartFTP conveniently has an API! So we decided to see if we could write a PowerShell script to use the SmartFTP api to automagically transfer/sync all of our deployment files in our Zip package to the necessary FTP site and with a bit of trial and error we managed to do it! Now, I’m not PowerShell expert or anything, and in fact this was my very first PowerShell script ever written so I’m sure this could all be done a bit better, but it works! I’m not going to go into detail about the SmartFTP api or how to write PowerShell stuff because this script will work with some basic requirements:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;You need both PowerShell and SmartFTP installed  &lt;li&gt;Currently this only supports the standard FTP protocol, but if you need SFTP, etc… you can just change the $fav variable’s ‘Protocol’ property  &lt;li&gt;The parameters, in this order are:  &lt;ul&gt; &lt;li&gt;destination  &lt;ul&gt; &lt;li&gt;the IP address, or host of your FTP server &lt;/li&gt;&lt;/ul&gt; &lt;li&gt;user  &lt;ul&gt; &lt;li&gt;the username used to login to the FTP server &lt;/li&gt;&lt;/ul&gt; &lt;li&gt;password  &lt;ul&gt; &lt;li&gt;the password used to login to the FTP server &lt;/li&gt;&lt;/ul&gt; &lt;li&gt;path  &lt;ul&gt; &lt;li&gt;The FTP path of where you want your files to go on your FTP server &lt;/li&gt;&lt;/ul&gt; &lt;li&gt;port  &lt;ul&gt; &lt;li&gt;The FTP port to use, default is 21 &lt;/li&gt;&lt;/ul&gt; &lt;li&gt;source  &lt;ul&gt; &lt;li&gt;The source folder to copy to the FTP site, if not specified, uses the current directory that the PowerShell script is run from &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Example usage:&lt;/p&gt; &lt;p&gt;FTPSync.ps1 123.123.123.123 MyUserName MyPassword 21 “C:\MyWebsiteFolder” “/websites/MyWebsite”&lt;/p&gt; &lt;p&gt;or you can just double click on the ps1 file and it will prompt you for these details.&lt;/p&gt; &lt;p&gt;So without further adieu, here’s the script!&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:05dcdeae-0505-4ccc-a0c0-afa7e389696a" class="wlWriterSmartContent"&gt;&lt;pre style="background-color: white; width: 600px; height: 600px; overflow: auto"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt;requires -version 2.0&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; Define inputs&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;param&lt;/span&gt;&lt;span style="color: #000000"&gt; (
    [parameter(Mandatory&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;$true&lt;/span&gt;&lt;span style="color: #000000"&gt;)]    
    [string]
    &lt;/span&gt;&lt;span style="color: #800080"&gt;$dest&lt;/span&gt;&lt;span style="color: #000000"&gt;,
    [parameter(Mandatory&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;$true&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
    [string]
    &lt;/span&gt;&lt;span style="color: #800080"&gt;$user&lt;/span&gt;&lt;span style="color: #000000"&gt;,
    [parameter(Mandatory&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;$true&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
    [string]
    &lt;/span&gt;&lt;span style="color: #800080"&gt;$pass&lt;/span&gt;&lt;span style="color: #000000"&gt;,
    [parameter(Mandatory&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;$true&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
    [ValidatePattern('\d&lt;/span&gt;&lt;span style="color: #000000"&gt;+&lt;/span&gt;&lt;span style="color: #000000"&gt;')]
    [int]
    &lt;/span&gt;&lt;span style="color: #800080"&gt;$port&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;21&lt;/span&gt;&lt;span style="color: #000000"&gt;,
    [parameter(Mandatory&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;$false&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
    [ValidateScript({ Test&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Path &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Path &lt;/span&gt;&lt;span style="color: #800080"&gt;$_&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;PathType Container })]
    [string]
    &lt;/span&gt;&lt;span style="color: #800080"&gt;$source&lt;/span&gt;&lt;span style="color: #000000"&gt;,
    [parameter(Mandatory&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #0000ff"&gt;$true&lt;/span&gt;&lt;span style="color: #000000"&gt;)]
    [ValidatePattern('\&lt;/span&gt;&lt;span style="color: #000000"&gt;/+&lt;/span&gt;&lt;span style="color: #000000"&gt;')]
    [string]
    &lt;/span&gt;&lt;span style="color: #800080"&gt;$path&lt;/span&gt;&lt;span style="color: #000000"&gt;
)

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; get current folder&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$currFolder&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; (Get&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Location &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;PSProvider FileSystem).ProviderPath;
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; set current folder&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #000000"&gt;[Environment]&lt;/span&gt;&lt;span style="color: #000000"&gt;::&lt;/span&gt;&lt;span style="color: #000000"&gt;CurrentDirectory&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #800080"&gt;$currFolder&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; if the source isn't set, then use the current folder&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #800080"&gt;$source&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;""&lt;/span&gt;&lt;span style="color: #000000"&gt;) {
    &lt;/span&gt;&lt;span style="color: #800080"&gt;$source&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$currFolder&lt;/span&gt;&lt;span style="color: #000000"&gt;;
}

Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;------------------------------------------------------&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;foregroundcolor yellow &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;backgroundcolor black
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;{0, -20}{1,20}&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #008080"&gt;-f&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;Destination&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #800080"&gt;$dest&lt;/span&gt;&lt;span style="color: #000000"&gt;);
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;{0, -20}{1,20}&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #008080"&gt;-f&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;User&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #800080"&gt;$user&lt;/span&gt;&lt;span style="color: #000000"&gt;);
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;{0, -20}{1,20}&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #008080"&gt;-f&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;Pass&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;********&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;);
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;{0, -20}{1,20}&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #008080"&gt;-f&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;Port&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;, &lt;/span&gt;&lt;span style="color: #800080"&gt;$port&lt;/span&gt;&lt;span style="color: #000000"&gt;);
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800000"&gt;""&lt;/span&gt;&lt;span style="color: #000000"&gt;;
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;Source:&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;;
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800080"&gt;$source&lt;/span&gt;&lt;span style="color: #000000"&gt;;
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800000"&gt;""&lt;/span&gt;&lt;span style="color: #000000"&gt;;
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;Path&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;;
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800080"&gt;$path&lt;/span&gt;&lt;span style="color: #000000"&gt;;
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;------------------------------------------------------&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;foregroundcolor yellow &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;backgroundcolor black

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; Create application&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$smartFTP&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; New&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Object &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;comObject SmartFTP.Application;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$smartFTP&lt;/span&gt;&lt;span style="color: #000000"&gt;.Visible &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; [bool]&lt;/span&gt;&lt;span style="color: #000000"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$smartFTP&lt;/span&gt;&lt;span style="color: #000000"&gt;.CloseAll();

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; create temp favorite item&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$smartFTP&lt;/span&gt;&lt;span style="color: #000000"&gt;.CreateObject(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;sfFavorites.FavoriteItem&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;);
&lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt;.Name &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$user&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;+&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt; @ &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;+&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$dest&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;+&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt; (temp favorite by cmdInterface)&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; 1 = FTP standard protocol&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt;.Protocol &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt;.Host &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$dest&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt;.Port &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$port&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt;.Path &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$path&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt;.Username &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$user&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt;.Password &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$pass&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; forces it not to be saved&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt;.Virtual &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;true&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;;

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; Add temporary favorite to SmartFTPs FavoriteManager&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$favMgr&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$smartFTP&lt;/span&gt;&lt;span style="color: #000000"&gt;.FavoritesManager;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$rootFolder&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$favMgr&lt;/span&gt;&lt;span style="color: #000000"&gt;.RootFolder;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$rootFolder&lt;/span&gt;&lt;span style="color: #000000"&gt;.AddItem(&lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt;);

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; Get the transfer queue&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$smartFTP&lt;/span&gt;&lt;span style="color: #000000"&gt;.TransferQueue;
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; stop the queue if it isn't already&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.State &lt;/span&gt;&lt;span style="color: #008080"&gt;-ne&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;) { &lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.Stop(); } &lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; Stopped = 1&lt;/span&gt;&lt;span style="color: #008000"&gt;
#&lt;/span&gt;&lt;span style="color: #008000"&gt; clear the queue&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt;&lt;span style="color: #000000"&gt;(&lt;/span&gt;&lt;span style="color: #800080"&gt;$item&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;in&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.Items) { &lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.RemoveItem(&lt;/span&gt;&lt;span style="color: #800080"&gt;$item&lt;/span&gt;&lt;span style="color: #000000"&gt;); }
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; set the thread count for the queue&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.MaxWorkers &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;20&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt;enable logging&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.Log &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;true&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.LogFolder &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$currFolder&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;+&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;\\LOG&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;;

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; create new transfer item&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$newItem&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$smartFTP&lt;/span&gt;&lt;span style="color: #000000"&gt;.CreateObject(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;sfTransferQueue.TransferQueueItem&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;);
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; set the item as a folder and copy operation, &lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$newItem&lt;/span&gt;&lt;span style="color: #000000"&gt;.type &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;2&lt;/span&gt;&lt;span style="color: #000000"&gt;;  &lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt;FOLDER = 2 &lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$newItem&lt;/span&gt;&lt;span style="color: #000000"&gt;.Operation &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;; &lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt;COPY = 1&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; Set the source&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$newItem&lt;/span&gt;&lt;span style="color: #000000"&gt;.Source.type &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;;  &lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt;LOCAL = 1&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$newItem&lt;/span&gt;&lt;span style="color: #000000"&gt;.Source.Path &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$source&lt;/span&gt;&lt;span style="color: #000000"&gt;;

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; Set the destination&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$newItem&lt;/span&gt;&lt;span style="color: #000000"&gt;.Destination.type &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;2&lt;/span&gt;&lt;span style="color: #000000"&gt;; &lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt;REMOTE = 2&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$newItem&lt;/span&gt;&lt;span style="color: #000000"&gt;.Destination.Path &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$path&lt;/span&gt;&lt;span style="color: #000000"&gt;;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$newItem&lt;/span&gt;&lt;span style="color: #000000"&gt;.Destination.FavoriteIdAsString &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$fav&lt;/span&gt;&lt;span style="color: #000000"&gt;.IdAsString; &lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt;links up to our connection favorite&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; and finally add it&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.AddItemTail(&lt;/span&gt;&lt;span style="color: #800080"&gt;$newItem&lt;/span&gt;&lt;span style="color: #000000"&gt;);

Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;STARTING&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;foregroundcolor yellow &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;backgroundcolor black;

&lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.Start();

&lt;/span&gt;&lt;span style="color: #0000ff"&gt;while&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.Items.Count &lt;/span&gt;&lt;span style="color: #008080"&gt;-ne&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;) { 
    Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;Processing...bytes transfered: &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.TransferredBytes;
    Start&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Sleep &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;s &lt;/span&gt;&lt;span style="color: #000000"&gt;2&lt;/span&gt;&lt;span style="color: #000000"&gt;; &lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt;wait 2 seconds&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #000000"&gt;}

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; store the total bytes&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$totalBytes&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.TransferredBytes;

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; cleanup smartftp app&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.Quit();
&lt;/span&gt;&lt;span style="color: #800080"&gt;$smartFTP&lt;/span&gt;&lt;span style="color: #000000"&gt;.Exit();

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; parse logs&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #000000"&gt;
&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; regex to find "[DATE/TIME] STOR FILENAME&lt;/span&gt;&lt;span style="color: #008000"&gt;
#&lt;/span&gt;&lt;span style="color: #008000"&gt; which indicates a file transfer&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #800080"&gt;$regex&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; new&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;object System.Text.RegularExpressions.Regex(&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;\[[\w\-\:]*?\]\sSTOR\s(.+?)\[&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;,,[System.Text.RegularExpressions.RegexOptions]&lt;/span&gt;&lt;span style="color: #000000"&gt;::&lt;/span&gt;&lt;span style="color: #000000"&gt;SingleLine);
&lt;/span&gt;&lt;span style="color: #800080"&gt;$totalFiles&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;;
Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;Files Transfered&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;foregroundcolor cyan &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;backgroundcolor black
Get&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;ChildItem &lt;/span&gt;&lt;span style="color: #800080"&gt;$queue&lt;/span&gt;&lt;span style="color: #000000"&gt;.LogFolder &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;include &lt;/span&gt;&lt;span style="color: #000000"&gt;*&lt;/span&gt;&lt;span style="color: #000000"&gt;.log &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Recurse &lt;/span&gt;&lt;span style="color: #000000"&gt;|&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #800080"&gt;$_&lt;/span&gt;&lt;span style="color: #000000"&gt;) { 
    &lt;/span&gt;&lt;span style="color: #800080"&gt;$currFile&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; Get&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Content &lt;/span&gt;&lt;span style="color: #800080"&gt;$_&lt;/span&gt;&lt;span style="color: #000000"&gt;.fullname;
    &lt;/span&gt;&lt;span style="color: #800080"&gt;$match&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$regex&lt;/span&gt;&lt;span style="color: #000000"&gt;.Matches(&lt;/span&gt;&lt;span style="color: #800080"&gt;$currFile&lt;/span&gt;&lt;span style="color: #000000"&gt;);    
    &lt;/span&gt;&lt;span style="color: #0000ff"&gt;if&lt;/span&gt;&lt;span style="color: #000000"&gt; (&lt;/span&gt;&lt;span style="color: #800080"&gt;$match&lt;/span&gt;&lt;span style="color: #000000"&gt;.Count &lt;/span&gt;&lt;span style="color: #008080"&gt;-gt&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;0&lt;/span&gt;&lt;span style="color: #000000"&gt;) {        
        &lt;/span&gt;&lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt;&lt;span style="color: #000000"&gt;(&lt;/span&gt;&lt;span style="color: #800080"&gt;$m&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #0000ff"&gt;in&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$match&lt;/span&gt;&lt;span style="color: #000000"&gt;) { Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800080"&gt;$m&lt;/span&gt;&lt;span style="color: #000000"&gt;.Groups[&lt;/span&gt;&lt;span style="color: #000000"&gt;1&lt;/span&gt;&lt;span style="color: #000000"&gt;]; } 
        &lt;/span&gt;&lt;span style="color: #800080"&gt;$totalFiles&lt;/span&gt;&lt;span style="color: #000000"&gt;++&lt;/span&gt;&lt;span style="color: #000000"&gt;;
    }
    remove&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;item &lt;/span&gt;&lt;span style="color: #800080"&gt;$_&lt;/span&gt;&lt;span style="color: #000000"&gt;.fullname &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Force &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Recurse ;
}

Write&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Host &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;COMPLETED (total bytes: &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$totalBytes&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;, total files: )&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #800080"&gt;$totalFiles&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;foregroundcolor cyan &lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;backgroundcolor black;

&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #800000"&gt;------------------------------------------------------&lt;/span&gt;&lt;span style="color: #800000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;

&lt;/span&gt;&lt;span style="color: #008000"&gt;#&lt;/span&gt;&lt;span style="color: #008000"&gt; cleanup COM&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #000000"&gt;Remove&lt;/span&gt;&lt;span style="color: #000000"&gt;-&lt;/span&gt;&lt;span style="color: #000000"&gt;Variable smartFTP&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;</description>
      <pubDate>Thu, 23 Mar 2023 15:08:09 Z</pubDate>
      <a10:updated>2023-03-23T15:08:09Z</a10:updated>
    </item>
    <item>
      <guid isPermaLink="false">1312</guid>
      <link>https://shazwazza.com/post/visualsvn-server-on-svn-protocol/</link>
      <category>etc...</category>
      <category>Hosting</category>
      <category>Servers</category>
      <title>VisualSVN server on SVN protocol</title>
      <description>&lt;div class="imported-post"&gt;This post was imported from FARMCode.org which has been discontinued. These posts now exist here as an archive. They may contain broken links and images.&lt;/div&gt;I’m sure I’m not the only one who has noticed that running SVN over the Http protocol using VisualSVN is REALLY slow in comparison to running SVN using the &lt;a href="file:///"&gt;file:///&lt;/a&gt; or svn:// protocol. It is nice having the option of the http protocol so at least you can browse your repositories in your browser, allow external access to them without opening up another port on your firewall and also apply Windows security to your repositories, however, it is really, really slow. After some Googling on how to get VisualSVN server to run using the SVN protocol, it turns out this is not possible but you can run the SVN protocol as a service in tandem with VisualSVN which will give you the best of both worlds. Luckily for us, VisualSVN installs all of the necessary files for us to do this. Here’s how:  &lt;ul&gt; &lt;li&gt;Create a batch file in your VisualSVN bin folder (normally: C:\Program Files\VisualSVN Server\bin) called something like: “INSTALLSVNPROTOCOL.bat”  &lt;ul&gt; &lt;li&gt;You’ll need to edit the below script to map your svn repository folders properly. Change the “E:\YOUR-SVN-REPOSITORY-ROOT-FOLDER” to the path of your svn repository root folder. &lt;/li&gt;&lt;/ul&gt;&lt;/li&gt;&lt;/ul&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:6871554c-fe1c-4b44-82bd-7ca600f9cf46" class="wlWriterSmartContent"&gt;&lt;pre style="background-color: white; width: 574px; word-wrap: break-word; white-space: pre-wrap; height: 202px; overflow: hidden"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000ff"&gt;echo&lt;/span&gt;&lt;span style="color: #000000"&gt; ---Install the service 

&lt;/span&gt;&lt;span style="color: #008000"&gt;REM&lt;/span&gt;&lt;span style="color: #008000"&gt; this should all be on one line!&lt;/span&gt;&lt;span style="color: #008000"&gt;
&lt;/span&gt;&lt;span style="color: #000000"&gt;sc create SVNPROTOCOLSERVICE binpath&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;\"c:\Program Files\VisualSVN Server\bin\svnserve.exe\" --service --root \"E:\YOUR-SVN-REPOSITORY-ROOT-FOLDER\" &lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; displayname&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; &lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt;SVN Service&lt;/span&gt;&lt;span style="color: #000000"&gt;"&lt;/span&gt;&lt;span style="color: #000000"&gt; depend&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; Tcpip

&lt;/span&gt;&lt;span style="color: #0000ff"&gt;echo&lt;/span&gt;&lt;span style="color: #000000"&gt; ---Config to auto-&lt;/span&gt;&lt;span style="color: #0000ff"&gt;start&lt;/span&gt;&lt;span style="color: #000000"&gt;
sc config SVNPROTOCOLSERVICE &lt;/span&gt;&lt;span style="color: #0000ff"&gt;start&lt;/span&gt;&lt;span style="color: #000000"&gt;=&lt;/span&gt;&lt;span style="color: #000000"&gt; auto&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Next, run your batch file. 
&lt;ul&gt;
&lt;li&gt;This will install a windows service to host your repositories on the SVN protocol &lt;/li&gt;&lt;/ul&gt;
&lt;li&gt;Update your windows service to run as Administrator, or a user that has the permissions to run the service 
&lt;ul&gt;
&lt;li&gt;Start Menu –&amp;gt; Adminstrative Tools –&amp;gt; Services –&amp;gt; Find the “SVN Service” that was just created –&amp;gt; Right click –&amp;gt; Properties –&amp;gt; Log On&amp;nbsp; Tab –&amp;gt; Change “Log on as:” to use your Administrator account. &lt;/li&gt;&lt;/ul&gt;
&lt;li&gt;Start the windows service &lt;/li&gt;&lt;/ul&gt;
&lt;p&gt;&lt;strong&gt;Your done!&lt;/strong&gt; You can now access your repositories via the SVN protocol using something like:&lt;/p&gt;
&lt;p&gt;svn://yourservername.yourdomainname.local/YOUR-REPOSITORY-NAME&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Ok, to uninstall:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Create a batch file in the same folder as your install batch file called something like “UNINSTALLSVNPROTOCOL.bat” &lt;/li&gt;&lt;/ul&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:13d5f319-ed8f-430c-b30d-c748ccaef504" class="wlWriterSmartContent"&gt;&lt;pre style="background-color: white; width: 326px; word-wrap: break-word; white-space: pre-wrap; height: 93px; overflow: hidden"&gt;&lt;div&gt;&lt;!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

--&gt;&lt;span style="color: #0000ff"&gt;echo&lt;/span&gt;&lt;span style="color: #000000"&gt; --remove svn service

sc stop SVNPROTOCOLSERVICE 
sc delete SVNPROTOCOLSERVICE&lt;/span&gt;&lt;/div&gt;&lt;/pre&gt;&lt;!-- Code inserted with Steve Dunn's Windows Live Writer Code Formatter Plugin.  http://dunnhq.com --&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Run the batch file &lt;/li&gt;&lt;/ul&gt;</description>
      <pubDate>Thu, 23 Mar 2023 15:08:09 Z</pubDate>
      <a10:updated>2023-03-23T15:08:09Z</a10:updated>
    </item>
  </channel>
</rss>