Powershell Method – No Screen Output

Do you ever notice that after you run a method in Powershell you often get some screen output that you didn’t want?

Example, calling a StringBuilder’s .Append() method to simply add more text to the string will echo details of the current capacity and remaining capacity of the StringBuilder object to the screen, which ruins your console look if your carefully laying it out

eg.

1
$StringBuilderObject.Append($alert.Name)

Will output capacity and remaining space information relating to the StringBuilder object to the screen.

To fix this, add [Void] before the beginning the the line, so it looks like this:

1
[Void]$StringBuilderObject.Append($alert.Name)

vBulletin To IP.Board – A Short Journey

Cheyne Wallace is a Sydney based Monitoring / Platform Engineer and Availability Manager – http://www.cheynewallace.com
http://www.soundpunk.com is the SMF site mentioned in this article to be converted to IPB

A long time SMF user , iv been growing a community based on an Simple Machines Forum for many years, and I have to say, its been great.
SMF has never given me troubles, I had complete control over my styles and templates, wrote several mods my self without ever really needing to understand the core system.

Upgrading the platform was dead simple, login to your panel one day and it tells you a new update is available, click update, it pulls the files down, checks that it wont break anything and prompts you to continue, all in all about a 1 minute procedure. Simple, (No pun intended)

SMF is great, although like many, the time has come for my community to expand, we often have people writing full length articles and posting in the forum, only to have them be bumped back into oblivion and never seen again, either that or end up with 400 sticky posts which is just messy.

I need a CMS, I need blogging, I need to post articles, and host downloads properly not as attachments. Im not interested in messy WordPress and Joomla bridges , despite the fact a WordPress blog is exactly what I want, iv been down that path before and it always turned out messy.

Fast forward to about December 2009, im looking around for a new solution, iv been a fairly big forum user over the years and I was very aware of vBulletin and its standing in the web community.

I begin investigating vBulletin licensing, my eyes widen as I see a new product is being launched over at vBulletin.com – vBulletin 4.0 Publishing Suite

Read more

Rotating URL Script – Dashboard Display

Iv been looking for a tool that will display web pages for a period of time and then cycle through to the next page,  performing a loop for usage on large LCD TV screen at work,  this is to be used to display IT Service performance information and status reports.

I was unable to find one that did what I wanted,  bar 1, although it suffered from a problem where after a few hours Internet Explorer would start to die, and it had to be restarted.

I decided to write my own script, and so here it is.

Read more

Taskkill – Kill All Process’s Of A Certain Name

So you may have run something thats spawned a whole bunch of processes,  iexplore.exe  or cscript.exe ,  you need to kill them all and fast.   Heres how

1
taskkill /F /IM iexplore.exe

Useful Windows Run Commands

A whole bunch of very useful Windows commands

Read more

Task Scheduler – The following error was reported: 2147944309.

This common task scheduler message is cryptic, and means nothing without some digging,  you can see below how we find the true answer to what it means,  but the short answer is:


Account Is Locked Out

Why?
0n2147944309 = 0x80070775
Facility: 8007 = Win32 (it’s a “Win32″ status code)
Status: 0x775 = 0n1909
Q:\>net helpmsg 1909
The referenced account is currently locked out and may not be logged on to.

T-SQL Setting Date Format

Occasionally you need to run a DATEDIFF or DATEADD against some dates that are in a reverse format, ie Day:Month:Year instead of Month:Day:Year, theres a simple way to set this in your query without having to string handle it all, using the SET DATEFORMAT parameter.

1
2
SET DATEFORMAT dmy
SELECT DATEDIFF(MINUTE,'29-01-2010 09:13:18','29-01-2010 09:18:18')

Windows Task Scheduler – Corrupt Image Error Fix

For some reason now with Vista and Windows Server 2008 when ever you seem to create a scheduled task, but close it before saving it, you get a “Corrupt Image” error that will not go away unless you remove the “Corrupt Image” from the registry.

Heres how to fix it

  1. Open The Registry (Start > Run > regedit)
  2. Browse to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache
  3. Under the “Tree” folder, find the scheduled tasks that you are having the error with and delete their folder.

Thats it, now re-open task scheduler and the error should be gone.

Copy your servers PHP.INI

Occasionally you may need to override your hosts or servers PHP.INI config file.  If you do, you’ll want a copy of the original PHP.INI as a basis for your modifications.
You can make a copy of it to your new directory by running a PHP script with the following

1
< ?php system("cp /usr/local/php5/lib/php.ini /home/your-new-path/php.ini"); ?>

Piracy and R18+ Games

So another game has been banned from Australia (Aliens vs Predator), and this time the developers are refusing to censor the content.

And I don’t blame them.

Why spend years developing and testing a game, finally deeming it ready for production only to have some narrow minded Government on the opposite side of the world tell you It needs to be re-edited so a 14 year old can buy it. I know what id tell them.

Read more

Ping Host From VB.Net

1
2
3
4
5
6
7
8
9
10
11
12
13
14
' --- ping the ip adress in the string s_ipaddr, and get
'     the response time in the int32 n_response

 
Imports system.net.networkinformation
Dim ping As New System.Net.NetworkInformation.Ping
Dim reply As System.Net.NetworkInformation.PingReply
reply = ping.Send(s_ipaddr)
If reply.Status = IPStatus.Success Then
' --- handle reachable here
MsgBox("ping time " &amp; reply.RoundtripTime)
Else
' --- handle non reachable here
End If

Pinger! – The Mass Host Ping Tool

Current Version v1.3 – Download Now

Pinger! is a tiny ping utility (13KB) that is used to quickly ping a large list of hosts and save the resulting successful and failure host lists into a text file.

Why?

When developing scripts and applications that will touch a large number of hosts,  if many of those hosts are offline or no longer exist, the timeouts involved with this can slow down execution time and dramatically slow down your script or application.

In my case, I was presented with a list of 600+ servers that needed to have the exact same script run against them, a successful server took only several milliseconds to finish,  a failed host took around 4 seconds to time out, clearly I needed to find out which servers were alive and which weren’t and further again I needed to list the successful servers in a clean text file, 1 host per line, so I could import this into my application as an array.

And hence Pinger! was born :)

Usage

Very simple, Pinger.exe when run looks for hosts.txt in the same directory. Simply enter in your list of host names in this text file,  one per line and Pinger! will run over them 1 by 1 and output the results.
Simply extract the .zip containing Pinger.exe and hosts.txt to the same directory and open Pinger.exe.

Output

2 files are outputted.  these are:

  • success.txt  – The list of successfully pinged hosts, in per line format
  • failure.txt – The list of hosts that failed to ping, in line by line format.
pinger

 

Download v1.0

IIS7 and Classic ASP – Enabling Error Messages

Recently iv switched a lot of my web apps from an IIS6 to an IIS7 server although this came with a few headaches, one of which was that now, I was unable to debug my code from the browser on my remote machine, instead just seeing an “Error Code 500 – Internal Server Error” message,  which is basically useless.

Iv found the solution, although it involves a few steps,  heres how.

  1. In your IIS7 control panel, under your site home area, double click on the “ASP” icon (In the bottom half, on my window).
    Expand the Debugging Properties toggle , and switch the Send Errors To Browser option to TRUE.
  2. Open up a command line and run this command:
    %windir%\system32\inetsrv\appcmd.exe set config -section:system.webServer/httpErrors -errorMode:Detailed
  3. If your using Internet Explorer, go into  Tools > Internet Options > Advanced , find the “Show friendly HTTP error messages” under the “Browsing” section and disable it.
  4. Thats it!  Your done.

Canon DSLR Range Basic Overview

Canon DSLR cameras come in 3 different target groups, which results in 3 different price brackets. 5DII Ill attempt to summarize as simply as possible what these groups are and hopefully clear up any confusions you may have with the Model numbering.

Read more

FireFox NTLM Authentication – Windows Authentication

Maybe its just me, but having to switch between Internet Explorer and Firefox to access Internal and External sites is a hassle.  Particularly the SharePoint based sites on Firefox.

So iv found a solution ..  If you want to use FireFox for all sites heres what I did to get it working.

In FireFox

Enable auto NTLM authentication for the internal sites that require domain accounts.

  1. Open FireFox and type about:config hit enter
  2. In the filter box type NTLM , find the key -  network.automatic-ntlm-auth.trusted-uris
  3. Add a comma separated string of URLS here .. Example http://intranet,http://somelocalsite,http://sharepoint
  4. Restart firefox

When you visit these sites now, you will be authentication in the same way you are with Internet Explorer without being prompted to login.  This is absorbed from your domain account.

T-SQL Copy Table To Another Database

Occasionally, you might do something stupid like run a SQL script on the wrong database, or setup your application to configure its table structure on the master DB.

When you do, here’s an easy way to copy the tables to another database (on the same server)

1
2
SELECT * INTO target_db.target_table_name
FROM source_db.source_table_name

Dear FireFox, Call Me When You’re Sober

Dear FireFox,

I wish I could say this to you in person although I fear that I may not be able to go through with it.

You’ve been my rock for so many years and you held my hand while I was weaning off Internet Explorer, and I thank you for that, but you’ve changed.

Read more

Register ASP.NET Version In IIS

If your IIS Web Service Extensions list is not showing your correct version of ASP.NET, ie It may only show version 1.1.3822 where as your using version 2 in your application, click start > run and then enter this command , replacing the .NET Framework version with your desired version.

1
C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe -I

Windows 2008 Perfmon Crashes – Reset User Defined Data Collector Sets

I discovered this very annoying bug in Windows Server 2008 when attempting to import an XML file with 100 serverswind2008 and counters in it.
No doubt one of the server had an issue and therefore and for some stupid reason, perfmon or Reliability And Performance Monitor, as its called now in 2008 is unable to handle this , and completely falls over.
Now, when you open Perfmon and try to view the User Defined Data Collector Sets, or run logman.exe from the command line, the application completely freezes and your unable to delete the corrupt dataset you just imported or even click elsewhere in the window.

In 2003, a reboot would fix this problem, but in 2008 it does not. The solution lies in the registry. Here’s how to fix the problem.

  1. Make sure your logged in as admin or with admin rights
  2. Close any open perfmon (Reliability and Performance Monitor) windows you have open.
  3. Click Start > Run then type  regedit hit enter
  4. Goto: HKLM\Software\Microsoft\Windows NT\CurrentVersion\Schedule\TaskCache\Tree\Windows\PLA
  5. You will see your Data Collector Sets in here, delete the one you created that caused the problem (or just delete them all if your not sure) **NOTE** Dont delete the “System” folder.
  6. Your done now, re-open perfmon, or logman and your problem should be solved.

SQL Replace Nulls With Blank String

Simple way to replace NULL values in your queries with blank strings by using the IsNull function.

This will allow for problem free string creation etc.

1
2
3
SELECT IsNull(ColumnName, '') 
As NewColumnName 
FROM TableName

More information can be found here: http://msdn.microsoft.com/en-us/library/ms184325.aspx