<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Speaking of which... : Script</title><link>http://blogs.msdn.com/johan/archive/tags/Script/default.aspx</link><description>Tags: Script</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>PowerShell - Editing permissions on a file or folder</title><link>http://blogs.msdn.com/johan/archive/2008/10/01/powershell-editing-permissions-on-a-file-or-folder.aspx</link><pubDate>Wed, 01 Oct 2008 15:52:49 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8971522</guid><dc:creator>JohanS</dc:creator><slash:comments>7</slash:comments><comments>http://blogs.msdn.com/johan/comments/8971522.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=8971522</wfw:commentRss><description>&lt;p&gt;I got the following question from a reader the other day:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;I've been trying to figure out how to change permissions on a folder in PowerShell. I've looked at the Get-Acl and Set-Acl, but I can only use them to copy the settings from a pre-existing object. How do I manually configure permissions?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;This is actually a quite common question, so I thought I'd write a quick post on the subject.&lt;/p&gt;  &lt;h1&gt;Get-Acl and Set-Acl&lt;/h1&gt;  &lt;p&gt;To quote the PowerShell documentation &amp;quot;Get-Acl &lt;em&gt;gets&lt;/em&gt; the security descriptor for a resource, such as a file or registry key.&amp;quot; while &amp;quot;Set-Acl &lt;em&gt;changes&lt;/em&gt; the security descriptor of a specified resource, such as a file or a registry key.&amp;quot; In other words; if you want Folder_A to have the exact same permissions as Folder_B, then you simply copy the Access Control List (ACL) of Folder_B and &amp;quot;paste&amp;quot; it onto Folder_A.&lt;/p&gt;  &lt;div class="SampleCode"&gt;   &lt;pre&gt;$Acl = Get-Acl &amp;quot;C:\Folder_B&amp;quot;
Set-Acl &amp;quot;C:\Folder_A&amp;quot; $Acl&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;So far, so good.&lt;/p&gt;

&lt;h1&gt;Changing the ACL&lt;/h1&gt;

&lt;p&gt;Okay, so you want to change the ACL. Here's some sample code for how to do that:&lt;/p&gt;

&lt;div class="SampleCode"&gt;
  &lt;pre&gt;New-Item -type directory -path C:\MyFolder
$Acl = Get-Acl &amp;quot;C:\MyFolder&amp;quot;
$Ar = New-Object  system.security.accesscontrol.filesystemaccessrule(&amp;quot;username&amp;quot;,&amp;quot;FullControl&amp;quot;,&amp;quot;Allow&amp;quot;)
$Acl.SetAccessRule($Ar)
Set-Acl &amp;quot;C:\MyFolder&amp;quot; $Acl&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;So, first we create a new folder. We then copy the ACL of that folder. We then create a new AccessRule that gives &amp;quot;username&amp;quot; full control. We then add this AccessRule to the ACL, and finally we reapply the new, altered ACL to the folder.&lt;/p&gt;

&lt;p&gt;If we wanted to we could also have used &lt;span class="InlineCode"&gt;$Acl.RemoveAccessRule($Ar)&lt;/span&gt; or possibly &lt;span class="InlineCode"&gt;$Acl.RemoveAccessRuleAll()&lt;/span&gt; as well.&lt;/p&gt;

&lt;p&gt;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8971522" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Script/default.aspx">Script</category><category domain="http://blogs.msdn.com/johan/archive/tags/Sample+Code/default.aspx">Sample Code</category><category domain="http://blogs.msdn.com/johan/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>PowerShell - Automatically organizing your mp3-collection</title><link>http://blogs.msdn.com/johan/archive/2008/09/23/powershell-automatically-organizing-your-mp3-collection.aspx</link><pubDate>Tue, 23 Sep 2008 14:53:23 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8962147</guid><dc:creator>JohanS</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/johan/comments/8962147.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=8962147</wfw:commentRss><description>&lt;p&gt;Is your mp3-collection perfectly sorted? I know mine wasn't. I thought I'd address that while creating a pretty good demo-script to show some basic filtering, script structures, etc. Since I also wanted the script to extract the metadata from every file in my collection I had to use the Shell.Application Com-object as well. All in all I think it turned out pretty well.&lt;/p&gt;  &lt;p&gt;NOTE:&lt;/p&gt;  &lt;p&gt;This script is provided completely as is. It is not an official product in any way and I take no responsibility for any harm it may cause.&lt;/p&gt;  &lt;p&gt;Please note that certain metadata editors that integrate directly into the Shell may cause some severe confusion in the metadata, so I'd recommend disabling them before trying. Off course I would also recommend making a backup copy of the music library before surrendering it to the mercy of PowerShell.&lt;/p&gt;  &lt;p&gt;If you're new to PowerShell and haven't done so already I'd recommend looking at my earlier posts on the subject:    &lt;br /&gt;&lt;a href="http://blogs.msdn.com/johan/archive/2008/05/28/powershell-an-introduction-part-i.aspx"&gt;PowerShell - An introduction, Part I&lt;/a&gt;     &lt;br /&gt;&lt;a href="http://blogs.msdn.com/johan/archive/2008/08/25/powershell-an-introduction-part-ii.aspx"&gt;PowerShell - An introduction, Part II&lt;/a&gt;&lt;/p&gt;  &lt;h1&gt;The script    &lt;br /&gt;&lt;/h1&gt;  &lt;div class="SampleCode"&gt;   &lt;pre&gt;Param([String] $Folder)
$INVALIDCHARS = [System.IO.Path]::GetInvalidPathChars() + &amp;quot;/&amp;quot;, &amp;quot;\&amp;quot;, &amp;quot;*&amp;quot;, &amp;quot;?&amp;quot;, &amp;quot;:&amp;quot;
$MUSICATTRIBS = &amp;quot;*.m4a&amp;quot;, &amp;quot;*.m4b&amp;quot;, &amp;quot;*.mp3&amp;quot;, &amp;quot;*.mp4&amp;quot;, &amp;quot;*.wma&amp;quot;, &amp;quot;*.flc&amp;quot;
$PLAYLISTATTRIBS = &amp;quot;*.m3u&amp;quot;, &amp;quot;*.zpl&amp;quot;
$ALLATTRIBS = $MUSICATTRIBS + $PLAYLISTATTRIBS&lt;br /&gt;$PLAYLISTSFOLDER = &amp;quot;Playlists&amp;quot;
$objShell = New-Object -ComObject Shell.Application
$iTotalFiles = 0
$iCurrentFile = 0

function checkFolderName($FolderName)
{
	&lt;font color="#00ff00"&gt;&lt;font color="#008000"&gt;# Make sure the folder doesn't contain any invalid characters&lt;/font&gt;
&lt;/font&gt;
	if(!$FolderName) { $FolderName = &amp;quot;Unknown&amp;quot; }
	$INVALIDCHARS | % {$FolderName = $FolderName.replace($_, &amp;quot;&amp;quot;)}
	return $FolderName
}



function MoveFiles($startDir)
{
	Write-Host &amp;quot;Indexing playlists...&amp;quot;
	
	&lt;font color="#008000"&gt;# Do a recursive DIR in the starting directory, include everything with the attributes of a playlist.
	# Filter the result by excluding everything that is a Container (folder)
&lt;/font&gt;	$dirResult = get-childitem -force -path $startDir -recurse -include $PLAYLISTATTRIBS | where{! $_.PSIsContainer}
	if($dirResult)
	{
		Write-Host &amp;quot;Moving playlists...&amp;quot;

		foreach($dirItem in $dirResult)
		{
			move-item $dirItem.FullName ($PLAYLISTSFOLDER + &amp;quot;\&amp;quot; + $dirItem.Name)
		}
	}
	Write-Host &amp;quot;Indexing music...&amp;quot;

&lt;font color="#008000"&gt;	# Do a recursive DIR in the starting directory, include everything with the attributes of a music file.
	# Again we filter the result by excluding everything that is a Container.
&lt;/font&gt;	$dirResult = get-childitem -force -path $startDir -recurse -include $MUSICATTRIBS | where{! $_.PSIsContainer}
	
&lt;font color="#008000"&gt;	# Make a note of how many hits we got, so we can show the progress to the client.
&lt;/font&gt;	$iTotalFiles = $dirResult.Count
	if($dirResult)
	{
		foreach($dirItem in $dirResult)
		{
&lt;font color="#008000"&gt;			# Up the counter for how many files we've processed so that we can show progress
&lt;/font&gt;			$iCurrentFile +=1

&lt;font color="#008000"&gt;			# Get the metadata for the file
&lt;/font&gt;			$fileData = getMP3MetaData($dirItem.FullName)
			
&lt;font color="#008000"&gt;			# Find the path where we the song should be stored
&lt;/font&gt;			$ArtistPath = $fileData[&amp;quot;Album Artist&amp;quot;]
			if (!$ArtistPath) { $ArtistPath = $fileData[&amp;quot;Artists&amp;quot;] }
			if (!$ArtistPath) { $ArtistName = &amp;quot;Unknown&amp;quot; }

&lt;font color="#008000"&gt;			# Make shure it's a valid path
&lt;/font&gt;			$ArtistPath = checkFolderName($ArtistPath)
			$AlbumPath = checkFolderName($fileData.Album)
			$ArtistPath = join-path $startDir $ArtistPath 
			$AlbumPath = join-path $ArtistPath $AlbumPath

&lt;font color="#008000"&gt;			# Check if the file should be moved
&lt;/font&gt;			if($dirItem.DirectoryName -ne $AlbumPath)
			{
				if(!(test-path $ArtistPath)) &lt;font color="#008000"&gt;# If the Artist folder doesn't exist
&lt;/font&gt;				{
					MKDIR $ArtistPath | out-null
				}
				if(!(test-path $AlbumPath)) &lt;font color="#008000"&gt;# If the Album folder doesn't exist&lt;/font&gt;
				{
					MKDIR $AlbumPath | out-null
				}
				move-item $dirItem.FullName ($AlbumPath + &amp;quot;\&amp;quot; + $dirItem.Name)
			}

&lt;font color="#008000"&gt;			# Show progress
&lt;/font&gt;			$percentage = ([int](($iCurrentFile / $iTotalFiles)*100))
			cls
			Write-Host &amp;quot;$percentage% ($iCurrentFile files of $iTotalFiles) complete&amp;quot;
		}
	}
}


function removeEmptyFolders($startDir)
{
&lt;font color="#008000"&gt;	# Get all folders and subfolders
&lt;/font&gt;	$dirResult = Get-childitem $startDir -recurse | where{$_.PSIsContainer}
	if($dirResult)
	{
		foreach($dirItem in $dirResult)
		{
&lt;font color="#008000"&gt;			# If the folder is empty (Doesn't contain any music or playlists) it should be deleted
&lt;/font&gt;			if(isfolderempty($dirItem.FullName))
			{
&lt;font color="#008000"&gt;				# Check if the path is still valid, we may have deleted the folder already recursively.
&lt;/font&gt;				if(Test-Path $dirItem.FullName)
				{
					remove-item -path $dirItem.FullName -force -recurse
				}
			}
		}
	}
}

function removeOtherFiles($startDir)
{
&lt;font color="#008000"&gt;	# Get all non-music files (except *.jpg-files) and remove them 
&lt;/font&gt;	$dirResult = Get-childitem $startDir -recurse -exclude ($ALLATTRIBS + &amp;quot;*.jpg&amp;quot;) | where{! $_.PSIsContainer}
	if($dirResult)
	{
		foreach($dirItem in $dirResult)
		{
			if(Test-Path $dirItem.FullName)
			{
&lt;font color="#008000"&gt;				# Make sure the file still exists, and hasn't been deleted already
&lt;/font&gt;				remove-item -path $dirItem.FullName -force
			}
		}
	}
}

function isFolderEmpty($folderPath)
{
&lt;font color="#008000"&gt;	# Search for any remaining music items in the folder.&lt;/font&gt;
	if(Test-Path $folderPath)
	{
		$dirChildren = get-childitem -force -path $folderPath -recurse -include $ALLATTRIBS | where{! $_.PSIsContainer}
		if($dirChildren -ne $null)
		{
			return $false
		}
		else
		{
			return $true
		}
	}
	else
	{
&lt;font color="#008000"&gt;		# No use trying to delete the folder if it doesn't exist
&lt;/font&gt;		return $false
	}
}

function getMP3MetaData($path)
{
&lt;font color="#008000"&gt;	# Get the file name, and the folder it exists in
&lt;/font&gt;	$file = split-path $path -leaf
	$path = split-path $path
	$objFolder = $objShell.namespace($path)
	$objFile = $objFolder.parsename($file)
	$result = @{}
	0..266 | % {
		if ($objFolder.getDetailsOf($objFile, $_))
		{
			$result[$($objFolder.getDetailsOf($objFolder.items, $_))] = $objFolder.getDetailsOf($objFile, $_)
		}
	}
	return $result
}

&lt;font color="#008000"&gt;# MAIN FUNCTION&lt;/font&gt;

&lt;font color="#008000"&gt;# If no argument was passed, see if anything was piped to the function instead.&lt;/font&gt;
if (!$Folder)
{
	$input | % { $Folder = $_ }
}

&lt;font color="#008000"&gt;# Check if the path is valid, if not reset it to &amp;quot;&amp;quot;&lt;/font&gt;
if ($Folder) { if (!(Test-Path -path $Folder)) { $Folder = &amp;quot;&amp;quot; }}

&lt;font color="#008000"&gt;# Since no valid path was given, prompt the user for a proper path.&lt;/font&gt;
while (!$Folder)
{
	&amp;quot;Please enter the full path to the folder where you wish to rearrange your MP3's&amp;quot;
	$Folder = Read-Host
	if ($Folder) { if (!(Test-Path -path $Folder)) { $Folder = &amp;quot;&amp;quot; }}
}

&lt;font color="#008000"&gt;# Make sure we have a folder to store the playlists in.&lt;/font&gt;
$PLAYLISTSFOLDER = join-path $Folder $PLAYLISTSFOLDER
if(!(test-path $PLAYLISTSFOLDER)) # If the Playlists folder doesn't exist
{
	MKDIR $PLAYLISTSFOLDER | out-null
}

&lt;font color="#008000"&gt;# Now that everything is ready, begin rearranging the files.&lt;/font&gt;
MoveFiles($Folder)
removeEmptyFolders($Folder)
removeOtherFiles($Folder)&lt;/pre&gt;
&lt;/div&gt;

&lt;h1&gt;&amp;#160;&lt;/h1&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;h1&gt;Running the script&lt;/h1&gt;

&lt;p&gt;So, how do you run this script?&lt;/p&gt;

&lt;p&gt;It's quite easy. The first step would be to copy it into notepad save it with a .ps1 extension and open up PowerShell&lt;/p&gt;

&lt;h2&gt;Execution policy&lt;/h2&gt;

&lt;p&gt;If this is the first time you try to execute a script from PowerShell you will most likely have to change the execution policy for PowerShell. I'd recommend setting it to RemoteSigned. This (obviously) means that all remote scripts must be signed or PowerShell will refuse to execute them. To change the execution policy simply type:&lt;/p&gt;

&lt;div class="SampleCode"&gt;Set-ExecutionPolicy RemoteSigned&lt;/div&gt;

&lt;p&gt;That's it.&lt;/p&gt;

&lt;p&gt;If you're uncertain what your execution policy setting is you simply type:&lt;/p&gt;

&lt;div class="SampleCode"&gt;Get-ExecutionPolicy&lt;/div&gt;

&lt;p&gt;Okay, having changed that we can now execute the script. If you saved the script in a folder that is in your system path you only need to type the filename of the .ps1 file. (The .ps1 is optional) So, if you saved it as RearrangeMP3s.ps1 you'd write &lt;span class="InlineCode"&gt;RearrangeMP3s&lt;/span&gt; and press enter &lt;/p&gt;

&lt;p&gt;&lt;/p&gt;

&lt;h1&gt;Breakdown&lt;/h1&gt;

&lt;p&gt;Okay, so let's take a look at the separate parts of the script.&lt;/p&gt;

&lt;h2&gt;Initial variables and constants&lt;/h2&gt;

&lt;p&gt;First we declare the parameters we're going to use. In this case it's just one: $Folder.&lt;/p&gt;

&lt;p&gt;After that we have some constants. You may want to change $MUSICATTRIBS or $PLAYLISTATTRIBS to include, or remove, extensions based on your needs. $PLAYLISTSFOLDER is a constant which indicates in which subfolder you wish to store your playlists.&lt;/p&gt;

&lt;p&gt;Finally we have some variables. $objShell is used for file system operations, and rather than creating a new object all the time I'd rather have a global one. $iTotalFiles and $iCurrentFile are two integers used to create a progress indicator.&lt;/p&gt;

&lt;h2&gt;Functions&lt;/h2&gt;

&lt;p&gt;After the initial variables come the sub functions called by the main function. To see what each individual function does I'd recommend looking at the comments. I've prioritized readability over minimum number of keystrokes, so yes, instead of writing:&lt;/p&gt;

&lt;div class="SampleCode"&gt;
  &lt;pre&gt;foreach($dirItem in $dirResult)
{
	move-item $dirItem.FullName ($PLAYLISTSFOLDER + &amp;quot;\&amp;quot; + $dirItem.Name)
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;I could have written&lt;/p&gt;

&lt;div class="SampleCode"&gt;
  &lt;pre&gt;$dirResult | % { mv $_.FullName ($PLAYLISTSFOLDER + &amp;quot;\&amp;quot; + $_.Name) }&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;But in this case I think that would have been counterproductive.&lt;/p&gt;

&lt;h2&gt;The main function&lt;/h2&gt;

&lt;p&gt;Finally we have the main function. It is written last in the script. Why is that? Well, actually PowerShell is the most sequential language you'll ever come across. It will not bother to check the entire script for function declarations. Instead it will go through the script one line at a time. This means that the following script will not work:&lt;/p&gt;

&lt;div class="SampleCode"&gt;
  &lt;pre&gt;SayHello

function SayHello
{
	Write-Host &amp;quot;Hello World&amp;quot;
}&lt;/pre&gt;
&lt;/div&gt;

&lt;p&gt;When you call SayHello in the sample above the function has not yet been declared, so PowerShell will throw an exception in your face saying that SayHello is unrecognized.&lt;/p&gt;

&lt;h1&gt;&lt;/h1&gt;

&lt;h1&gt;Footnote&lt;/h1&gt;

&lt;p&gt;There is actually a &lt;em&gt;supported&lt;/em&gt; way of achieving the very same thing, but where's the fun in that?&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Open up Windows Media Player&lt;/li&gt;

  &lt;li&gt;Go to Options -&amp;gt; Library and tick the checkbox for &amp;quot;Rearrange music in rip folder&amp;quot;&lt;/li&gt;

  &lt;li&gt;Go to the &amp;quot;Rip Music&amp;quot;-tab&lt;/li&gt;

  &lt;li&gt;Make sure the path is correct in the &amp;quot;Rip music to this location&amp;quot;-section&lt;/li&gt;

  &lt;li&gt;Click OK&lt;/li&gt;

  &lt;li&gt;Select &lt;em&gt;all&lt;/em&gt; files in the library&lt;/li&gt;

  &lt;li&gt;Right-click and choose the &amp;quot;Advanced Tag Editor&amp;quot;-option&lt;/li&gt;

  &lt;li&gt;Do not change anything. Simply click Apply&lt;/li&gt;

  &lt;li&gt;Windows Media Player will now rearrange all the files using your Rip settings.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;/ Johan&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8962147" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Script/default.aspx">Script</category><category domain="http://blogs.msdn.com/johan/archive/tags/Sample+Code/default.aspx">Sample Code</category><category domain="http://blogs.msdn.com/johan/archive/tags/PowerShell/default.aspx">PowerShell</category></item><item><title>Stress-O-Matic</title><link>http://blogs.msdn.com/johan/archive/2006/11/27/stress-o-matic.aspx</link><pubDate>Mon, 27 Nov 2006 13:41:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:1159132</guid><dc:creator>JohanS</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/johan/comments/1159132.aspx</comments><wfw:commentRss>http://blogs.msdn.com/johan/commentrss.aspx?PostID=1159132</wfw:commentRss><description>&lt;H1&gt;A very simple stress-test&lt;/H1&gt;
&lt;P&gt;The other day I was asked by a customer if I a small application that could be used to stress a web application. I didn't feel like responding "Sure I do! Visual Studio 2005 Team Edition For Software Testers" and I also didn't feel like saying "Why don't you make one yourself using the webbrowser control?" So instead I wrote a small script. It's all very basic and simple, but I still thought it might be of use to someone. Just copy the code below into a .vbs-file and you're good to go.&lt;/P&gt;
&lt;P&gt;Please note, however that the script relies heavily on WScript.Echo to tracks it's progress, so you should use CScript as the host rather than WScript. If you're unfamiliar with CScript &amp;amp; WScript I recommend taking a look at this article: &lt;A href="http://msdn2.microsoft.com/en-us/library/xazzc41b.aspx" mce_href="http://msdn2.microsoft.com/en-us/library/xazzc41b.aspx"&gt;MSDN: Running Scripts from Windows&lt;/A&gt;&lt;/P&gt;
&lt;DIV class=SampleCode&gt;
&lt;P&gt;CONST NUMBEROFLOOPS = 3 '****** How many times do you want the script to loop?&lt;BR&gt;CONST DELAYTIME = 3 '****** How many seconds do you want to wait?&lt;BR&gt;CONST URL = "http://www.microsoft.com"&lt;BR&gt;Dim Http&lt;BR&gt;Set Http = CreateObject("MSXML2.XMLHTTP") 
&lt;P&gt;Main 
&lt;P&gt;Function SendHTTPRequest()&lt;BR&gt;&amp;nbsp;&amp;nbsp; Http.Open "GET", URL , False&lt;BR&gt;&amp;nbsp;&amp;nbsp; Http.setRequestHeader "If-None-Match","qwerty"&lt;BR&gt;&amp;nbsp;&amp;nbsp; Http.setRequestHeader "Cache-Control","no-cache,max-age=0"&lt;BR&gt;&amp;nbsp;&amp;nbsp; Http.setRequestHeader "Pragma","no-cache"&lt;BR&gt;&amp;nbsp;&amp;nbsp; Http.send&lt;BR&gt;&amp;nbsp;&amp;nbsp; '****** Uncomment this in case you want to see the response for some reason...&lt;BR&gt;&amp;nbsp;&amp;nbsp; 'WScript.Echo(Http.responseText) &lt;BR&gt;End Function 
&lt;P&gt;Sub Main()&lt;BR&gt;&amp;nbsp;&amp;nbsp; Wscript.Echo("Test started at: " &amp;amp; Now())&lt;BR&gt;&amp;nbsp;&amp;nbsp; WScript.Echo("Will access """ &amp;amp; URL &amp;amp; """ " &amp;amp; NUMBEROFLOOPS &amp;amp; " times in " &amp;amp; DELAYTIME &amp;amp; " second intervals.")&lt;BR&gt;&amp;nbsp;&amp;nbsp; For I = 1 to NUMBEROFLOOPS&lt;BR&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; WScript.Echo( I &amp;amp; ": Accessing """ &amp;amp; URL &amp;amp; """")&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; SendHTTPRequest()&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Wscript.Echo("Waiting " &amp;amp; DELAYTIME &amp;amp; " seconds:")&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; For J = DELAYTIME To 1 Step -1&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; WScript.Sleep 1000&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Wscript.Echo("Waiting " &amp;amp; J-1 &amp;amp; " seconds:")&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; Next&lt;BR&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; WScript.Echo( I &amp;amp; ": Complete")&lt;BR&gt;&amp;nbsp;&amp;nbsp; Next&lt;BR&gt;&amp;nbsp;&amp;nbsp; Wscript.Echo("Test completed at: " &amp;amp; Now())&lt;BR&gt;End Sub&lt;/P&gt;&lt;/DIV&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That's all for now.&lt;/P&gt;
&lt;P&gt;/ Johan&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=1159132" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/johan/archive/tags/Script/default.aspx">Script</category><category domain="http://blogs.msdn.com/johan/archive/tags/Stress/default.aspx">Stress</category><category domain="http://blogs.msdn.com/johan/archive/tags/Sample+Code/default.aspx">Sample Code</category></item></channel></rss>