Friday, May 24, 2013

What I Learned at the Scripting Games - Part 3

Well the number one thing I got out of this week was that we need to raise our domain functional level to server 2008R2 (at a minimum).

I spent quite a while getting the script to work with server 2003 domain controllers. A point that seemed lost on the crowd.


There are some neat tricks in this script though and I learned a lot because I chose to make it harder on myself. Casting Types, BitWise checks, "filetime" oh and most importantly the CSS for pink mouse hovering!  Credit there must go to my boss Nathan. Well for the mouse over bit... The pink was all me!


If server 2008 was going to be the target platform we could have used something like this;

Get-ADUser | Get-Random -Count 20 | select all the stuff | ConvertTo-Html Blah blah


But I had fun none the less. The scripting games has been really fun and informative. It's really great seeing how different scripters will attack the same problem. Bring on Problem 5!

Also I should being planning that domain functional level upgrade... There's a lot of powershell goodness to be leveraged!


Friday, May 17, 2013

What I Learned at the Scripting Games - Part 2


Script for event 3 has been a hit (so far)! It’s crowd score is tracking above 4 stars for now. That's a big improvement from last week!


This was the problem 

The positive reception seems to be mainly linked to the time spent making the output look pretty with some CSS. Setting the formatting so the script is super easy to read doesn't hurt either.


Script is here as an image because when you include HTML tags the blogger platform gets all huffy.

Someone pointed out that it could be more efficient. I’m doing;
Get-WmiObject win32_logicaldisk -computername $server | Where-Object {$_.DriveType -eq 3} |

Where it could be;
Get-WmiObject win32_logicaldisk -computername $server –filter=”Drivetype=3” |

Mine executes two commands (get-wmiobject and where-object) when the same result could be achieved with one. If this script was running over tens of thousands of hosts it might make a difference. Plus it’s neater with one command.

So lessons learned this week;
  • Make sure you are being as efficient as possible even if your script is only going to be run on one host today... That will almost certainly not be the case tomorrow
  • Spending a bit of effort making the output "pretty" is worth the effort
  • Spending time to make your script readable will help others comprehend what you are doing. It'll also help future you figure out what you were thinking
  • There may still a place for oddball humor in comments! 

Monday, May 13, 2013

What I Learned at the Scripting Games


I'm competing in this years PowerShell Scripting Games 

They come up with a new problem each week, we have a week to write a script to solve that problem. Our scripts are submitted and reviewed by the crowd who can post comments. I've received some great feedback already!

The first script I submitted  received a mediocre reception. Which is totally fair looking at it, there are some real rookie errors in it. It’s great though because the point of the Scripting Games is to LEARN! We've got some of the top people in the powershell community critiquing our work! it's fantastic!


My Script ended up look like this;
$servers = c:\iplist.txt
$report = @()
foreach ($server in $servers)
       {
       $temp = "" | Select Hostname, Cores, Memory
       $cores = Get-WmiObject win32_processor -ComputerName $server | Select numberofcores
       $memory = Get-WmiObject Win32_ComputerSystem -ComputerName $server | Select TotalPhysicalMemory
       $hostname = Get-WmiObject Win32_ComputerSystem -ComputerName $server | Select Name
       $temp.Hostname = $hostname.Name
       $temp.Cores = $cores.numberofcores
       $temp.Memory = $memory.TotalPhysicalMemory
       $report += $temp
       }
$report | Export-Csv c:\drscriptosservers.csv –notype


So far the feedback has been very useful and there is some great learning. This is what I've gleaned.;
  • The script is inefficient because it queries WMI more times than it needs to. We can just make one query per WMI class.
  • PowerShell is great because it’s an object-oriented pipeline. The script sends its output to a CSV, which means the output can’t be piped anywhere else. Best practice is to send output to a PowerShell object and let the user do what they want with it. If they want it in a CSV they can pipe it to EXPORT-CSV themselves
  • When we write scripts for other people we should use the full names of the commands and parameters. That just makes the script “self-documenting” and much easier for to read


Event 3 has opened up so we’ll see how that turns out next week.


Tuesday, April 19, 2011

Not an Abomination at all

There is something interesting happening in the gaming industry right now.


Valve software is using the hype around the release of Portal 2 to promote a selection of indie games available through steam.

The idea is if enough people buy and play games from the “potato sack” http://store.steampowered.com/sub/7586/ they’ll release Portal 2 early.

It’s an interesting strategy, using excitement for a long anticipated product to push 13 titles by independents.

The execution has been great. The community first got wind that something was up on the 1st of April, when they were playing these indie games and Portal 2 themed levels started popping up. They could then follow clues in those games to clues in the real world! It seems quite intricate http://forums.steampowered.com/forums/showthread.php?t=1824635

Then supposedly once enough clues we found Glados@home came online. The idea then being that if enough people played the Portal2 themed content we could reboot Glados sooner.

I must say at first I was offended that they wanted me to spend more money and time to try and get portal 2 early. But hearing the Defence Grid guy having a conversation with Glados was just too funny to miss!

It’s a very interesting promotion and reinforces Valves position as a leader in the ongoing development of gaming in an online world.

Oh yes just FYI - that title won't make sense to anyone but the person to whom it does.

Monday, April 18, 2011

I guess they didn't see my last post




Clearly they're not reading my blog!
http://occasionalutility.blogspot.com/2011/04/swashbuckling-scoundrels.html

I'm sorry but stuff like this doesn't work on those with critical thinking abilities.


Pushing propaganda for a physical product onto a market where the user can instantly get what they want, is a desperate strategy.


Please can we just move on from DVD already?

Wednesday, April 6, 2011

Swashbuckling Scoundrels

OK it's been a while since I've had a rant so please indulge me. There's a lot of news buzzing around about piracy and Intellectual Property legislation at the moment. I'm not really going to argue the ethics and philosophical elements of both sides of the debate. What I'm interested in the reality of the situation as it stands.


That is; The pirates have a better product!


It’s already entirely possible for a person with average computer literacy to never watch free to air TV again. It's all there available to be delivered over your net connection! There are legal streaming services running right now that make it possible to catch all your favorite shows with just a little organistation.


Some of these services are facing backlash from the established media industries which may result in a contraction of the sphere of available content. The thing is, this path, the streaming service path, is a great solution to the media industries concerns. You see those services make it easy for people to get their content legally. Remember how if you make something easy, more people will do it!?


What the content creators are failing to grasp, is that users with sufficient technical sophistication are  able to locate and acquire any content they desire. That's the simple reality. This is the market they're finding themselves in and they're not liking it at all! The "pirates" have a better product.


If you want to legally watch a movie in the comfort of you own home you need to wait until that movie is released in a format you can consume, these releases come months or years after the theatrical release. The pirates don't have to wait at all. They can watch the latest block buster movie when it's still in theaters. The quality is often poor, but it's important to note that people are willing to suffer low quality just to experience the new content in their homes, that says a lot for making the content easier to access. Doesn't it?


If you want to legally watch a movie or TV show that has gone out of print you've got to scour the bargain bins or spend time looking for second hand DVDs and we all know what old DVDs add to the movie viewing experience don't we? It's not a positive contribution either is it? So while you're polishing scratches out of your optical disks. The pirate types the film title into a search box and starts microwaving his pop corn!


If you want to legally watch a DVD in a developing country you need to pay a substantially greater proportion of your income than you would in a first world country. There's been an excellent report produced on this that is well worth a look.


http://piracy.ssrc.org/the-report/ it's free if you live in a developing country... $8 if you don't.


Part of the problem is a lot of people in the content creation Industries lack technical sophistication. They may see the online world as a new channel for distribution but not much more than that. They've heavily invested in traditional scarcity based economics and this blinds them to the obvious reality that the game of content distribution has changed forever. Have a look at this poor Canadian Rock band. They thought they'd experienced massive loses due to piracy, turns out they'd been fooled by a clever script on an advertising site and no one was listening to their music, pirated or not! 


Attempts to legislate in order to protect old scarcity based business models may create problems for innovators in the future. Not to mention the fact that there may not be enough money in the world to cover damage claims in some cases based on the existing laws! 


The reality is the pirates have a better product. Users who are willing to ignore IP law are already able to watch whatever they want whenever they want. Attacking streaming services that can legally come close to that level of convenience seems misguided and a step in the wrong direction. Legislating to bring scarcity economics to the Internet where abundance was the fundamental key to it's success risks stifling innovation and even worse is likely to drive more customers into the arms of the pirate community.


If you want to beat the pirates you must make a better product! Over the past 2 decades the current value proposition from established content industries has been casually undermined by groups of loosely orgainised enthusiasts who just want to enjoy their media content on their own terms. This isn't an attack of the Media industries it's just society evolving and making use of the new technologies in order to entertain themselves.


The challenge for the content creators is to set a price point so that for the majority of consumers the value proposition of legal content outweighs the effort required to acquire free content.

Monday, April 4, 2011

What’s Your Alignment?

Ok this is really nerdy and not useful at all… Or is it!?

When looking at personality types there are many systems for codifying and documenting a person’s world view. But none work as well for me as the Character alignment system from Dungeons and Dragons. I won’t explain it here it’s been done far better elsewhere...

http://en.wikipedia.org/wiki/Alignment_%28Dungeons_%26_Dragons%29

I was having a think about it today and realised I was Chaotic Good, my boss is Chaotic Neutral. Our GM is Lawful Neutral. It goes on…

Our network admin is Chaotic Good like me. Of our two helpdesk staff one is True Neutral the other Lawful Good.

The organisation as whole reflects the values of the GM and is Lawful Neutral.

I was pleased to see that no one in my life is actively evil…. But that’s not to say there aren’t evil people in my life, just that if there are, they’re hiding it well. Wouldn’t you if you were Evil that’s kind of part of whole the “evilness” of evil, right?

I don’t know why I’m just realising this now but it’s so clear that the organisational values in my workplace don’t mesh well with my own world view. Anyone know of a fun Chaotic Good workplace? I’m looking to make some changes and DnD Alignments seem like a good criteria for decision making.

As a management tool this is works far better than it should. As a framework for helping a nerd understand the people around him it’s dam near indispensible!