How do I write a cmdlet script?

I was a bit shocked at how "difficult" it was to find how to create a cmdlet script.  After all, it was pretty basic to write a cmd (or bat) file and just run it.

Anyway, here's the trick.

rename the file "myscript.ps1" (yes, that's right, .ps1 suffix, not .ps, nor .ps2, and 3 is two too far, 4 would be way out.  .ps1 it shall be).

I'm sure there's a story for this suffix, it would be nice to hear it.

Next, you need to sign your script so PS will allow it to run.  This is covered in numerous places, including the docs that came PS.

Update:

set-executionpolicy remotesigned

Will usually give you what you need - unchecked local execution but remote scripts (such as a remote-admin) must be signed.

get-help set-executionpolicy
get-help about_signing

Write this cmdlet

# filter directories, look for cs files.
$files = get-chilitem . -include *.cs -recurse
$regex = new-object -type System.Text.RegularExpressions.Regex "pattern"
foreach($file in $files){

$content = get-content $file
# run regex

if (regex.IsMatch(content)) {

#write-out
$file

}

}

#sorry for the lack of spacing - I'm typing code in a blog editor and pressing spaces is too much work

Few bits of update

  1. Quit WoW (raiding too stressful, RL work taking up too much time)
  2. Started playing LOTRO (no more raids this time)
  3. Workload is heavy but I'm having fun again, which makes the experience quite a lot better.
  4. I need more food (hmm, when is this not the case)
  5. Sister came home from overseas
  6. Changed ISP to TPG, mainly for the static IP address - I have an earlier rant about this one.
  7. One of my fish died.  Now only 6 fish.  I'm really worried for the other small one.  But the tank is too small to get more fish.  Lina suggests that we get a bigger fish tank.  I think she's loving the idea.

Google-whacking techniques for naming your jira tickets.

Because JIRA search just sucks that bad.  We need extra help.

Here's an idea.  When you name a ticket for a task that you need to do in your project, pick a very unique name that you can always remember later.

For example, a web form:

Business Maintenance Form reloaded

or

There are two files here, please pick one and kill the other.

---

Then when you need to find the issue ticket again, it's simple to search for your 'keyword'.

CommunityServer sucks?

I think I'm about to give up.

I've spend the last 2 weeks of my life fighting with CommunityServer, and as far as I can determine, this is a product that is NOT designed for other developers.

Lack of documentation.  Lack of up-to-date examples or explanation of the layout of the SDK means that a typical developer spends weeks and weeks in the dark about where things are.

Forums are completely useless - with questions and answers relating to older versions that doesn't apply.

If you are after a good Blog/Forum/CMS software, look elsewhere.