Hello world!
Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
1 Comment »
Filed under: Uncategorized
Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!
1 Comment »
Filed under: Uncategorized
If you want to install SQL Server 2005 on Windows Server 2008 (formally Longhorn server), you need to be aware of the process.
Note: This was worked out on Windows Server Longhorn Beta 3 (build 6001), so procedures may change by the time Windows Server 2008 RTM’s.
Prerequisites
If you’re planning on installing SQL Reporting on Windows Server 2008, you need to add the IIS Role through server manager and you need the following service components installed:
For more information I suggest that you read William Li’s blog post on the subject. It’s referring to an older version of Longhorn Server, but is still pretty sound.
Installation
Installing SQL Server 2005 is a little painful now-a-days; the process goes like this if you do a complete install like I did:
No Comments »
Filed under: SQL Server 2005, Windows Server 2008
I’m currently downloading the March CTP of Visual Studio Orcas. There’s two versions this month, a Virtual PC image and for the first time a full install. Combined this all totals 11.9GB and 20 files to download!
So how long will it take to download on my 4Mbs Internet Connection?
1> New-TimeSpan -seconds $(11.9gb / (4mb / 8))
Days : 0
Hours : 6
Minutes : 46
Seconds : 11
Milliseconds : 0
Ticks : 243710000000
TotalDays : 0.282071759259259
TotalHours : 6.76972222222222
TotalMinutes : 406.183333333333
TotalSeconds : 24371
TotalMilliseconds : 24371000
Of cause, that’s the theoretical maximum of my line, in reality I tend to get about 480KBs:
2> New-TimeSpan -seconds $(11.9gb / (480kb))
Days : 0
Hours : 7
Minutes : 13
Seconds : 16
Milliseconds : 0
Ticks : 259960000000
TotalDays : 0.30087962962963
TotalHours : 7.22111111111111
TotalMinutes : 433.266666666667
TotalSeconds : 25996
TotalMilliseconds : 25996000
Not bad, it’ll e done by breakfast J
I often compute this on a calculator, but PowerShell offers us a better alternative, but typing it into the command line every time will get old very fast. So I’ve just knocked together a little script to do this for me.
Usage: Calc-DownloadTime.ps1 <downloadSize> [connectionSpeed]
Both parameters are int64’s and if connectionSpeed is not supplied, it will try to use a global variable named $networkSpeed. Should the $networkSpeed global variable not exist, the script will throw an exception.
1 Comment »
Filed under: PowerShell
Mamood had a problem! He needed to get some information on a bunch of machines he manages and like a good follower of the church of PowerShell, he fired up his favourite blue and white command line tool (which he for some reason changes to be black with green text) and set about trying to obtain the information required.
Somewhere along the way he got stuck, so somehow he managed to find his Office Communicator window in amongst what must have been at least 50 others including several terminal server client sessions (each containing at least another 20 windows) and contacted me. He needed to perform a nslookup on an IP Address and grep the resolved host name for his information.
I sent him back the following three functions (cobbled together on the spur of the moment):
function Ping-Host([string]$hostName) {
$pinger = new-object system.Net.NetworkInformation.Ping;
$pinger.Send($hostName);
}
function Resolve-HostByAddress([string]$ipAddress) {
return [System.Net.Dns]::GetHostByAddress($ipAddress);
}
function Resolve-HostByName([string]$hostName) {
return [System.Net.Dns]::GetHostByName($hostName);
}
I then told him to save them in a script called networkTools.ps1 and then Dot-source them into his session and have a play to see if they do what he wanted:
[D:\PsScripts]
1> . .\networkTools.ps1
[D:\PsScripts]
2> resolve-hostByName “localhost”
HostName Aliases AddressList
——– ——- ———–
machine1.cpatinliteral.net {} {127.0.0.1}
[D:\PsScripts]
3> resolve-hostByAddress “192.168.8.5″
HostName Aliases AddressList
——– ——- ———–
machine1.cpatinliteral.net {} {192.168.8.5}
[D:\PsScripts]
4> “machine1″, “machine2″, “machine3″ | % { resolve-hostByName $_ }
HostName Aliases AddressList
——– ——- ———–
machine1.captainliteral.net {} {192.168.8.5}
machine2.captainliteral.net {} {192.168.8.3}
machine3.captainliteral.net {} {192.168.8.8}
No Comments »
Filed under: PowerShell
One of the reasons why PowerShell is so good and so easy to sell to people is because of .NET. PowerShell is a .NET 2.0 application and it uses .NET to achieve virtually everything it does – but how can users leverage to power of .NET from within PowerShell?
How do I create an object?
There are basically two way to get an object to work with in PowerShell, either call new-object or get one returned by calling something.
Things return objects?
[D:\PsScripts]
1> get-process
Handles NPM(K) PM(K) WS(K) VM(M) CPU(s) Id ProcessName
——- —— —– —– —– —— — ———–
256 12 77716 70736 558 0.91 5680 powershell
What’s actually going on here? It turns out that the get-process cmdlet returns .NET objects, in the above case it’s an array of System.Diagnosticts.Process objects and that allows us to work with them the same as if we had created them in code.
You can work with objects by either keeping a reference to them or by passing them down the pipeline to another cmdlet, object or piece of script. If you want to know what you can do with an object, call get-member:
[D:\PsScripts]
2> $processes = get-process
[D:\PsScripts]
3> $processes.Length
90
[D:\PsScripts]
4> get-member -InputObject $processes
TypeName: System.Object[]
Name MemberType Definition
—- ———- ———-
Count AliasProperty Count = Length
… … …
An object array? Where are the process objects?
[D:\PsScripts]
5> get-member -InputObject $processes[0]
TypeName: System.Diagnostics.Process
Name MemberType Definition
—- ———- ———-
Handles AliasProperty Handles = Handlecount
Name AliasProperty Name = ProcessName
… … …
No Comments »
Filed under: PowerShell
I’ve been using PowerShell now for a few months and it’s become a standard feature on my desktop. Having used it for a while I have some observations to share:
IDE
PowerShell doesn’t have an IDE shipped as part of the product, so the out-of-the-box experience of scripting it limited to nothing more fancy than Notepad. My experience though has been that an IDE of some sorts really is required for working with anything but the most basic .ps1 script files. Additionally, I’ve had bugs in one-liners that pipe together several command and full IDE support for pipelines would be a real winner – imagine being able to set a breakpoint between piped commands.
The main features that I would like an IDE for PowerShell to provide are:
4 Comments »
Filed under: PowerShell
I spent a lot of time automating SharePoint when the company I work for installed SharePoint Portal Server 2003, so I was quite disappointed when SharePoint version 3 was released without PowerShell support – after all, Exchange 2007 managed it and it’s part of the Office 2007 Server suite, so why didn’t the other server products?
On a positive note though, I did find that stsadm.exe had been extended to now support a lot more operations:
[C:\Program Files\Common Files\Microsoft Shared\web server extensions\12\BIN]
3> .\stsadm.exe –help
Usage:
stsadm.exe -o <operation> [<parameters>]
stsadm.exe -help [<operation>]
Operations:
activatefeature
addalternatedomain
addcontentdb
addpath
addpermissionpolicy
addsolution
addtemplate
adduser
addwppack
addzoneurl
authentication
backup
backuphistory
binddrservice
blockedfilelist
canceldeployment
changepermissionpolicy
copyappbincontent
createadminvs
creategroup
createsite
createsiteinnewdb
createweb
databaserepair
deactivatefeature
deleteadminvs
deletealternatedomain
deleteconfigdb
deletecontentdb
deletegroup
deletepath
deletepermissionpolicy
deletesite
deletesolution
deletetemplate
deleteuser
deleteweb
deletewppack
deletezoneurl
deploysolution
deploywppack
disablessc
displaysolution
email
enablessc
enumalternatedomains
enumcontentdbs
enumdeployments
enumgroups
enumroles
enumservices
enumsites
enumsolutions
enumsubwebs
enumtemplates
enumusers
enumwppacks
enumzoneurls
execadmsvcjobs
export
extendvs
extendvsinwebfarm
forcedeletelist
getadminport
getproperty
getsitelock
geturlzone
import
installfeature
listlogginglevels
localupgradestatus
managepermissionpolicylevel
migrateuser
provisionservice
refreshdms
refreshsitedms
registerwsswriter
removedrservice
removesolutiondeploymentlock
renameserver
renameweb
restore
retractsolution
retractwppack
scanforfeatures
setadminport
setapppassword
setconfigdb
setlogginglevel
setproperty
setsitelock
setworkflowconfig
siteowner
spsearch
spsearchdiacriticsensitive
syncsolution
unextendvs
uninstallfeature
unregisterwsswriter
updateaccountpassword
updatealerttemplates
updatefarmcredentials
upgrade
upgradesolution
upgradetargetwebapplication
userrole
For information about other operations and parameters,
use “stsadm.exe -help” or “stsadm.exe -help <operation>”
But how useful are these commands? Consider the example of enumsites – this command lists all Site Collections or a given Web Application.
1 Comment »
Filed under: PowerShell, SharePoint
One of the comments I had on a post I did last week was about how to run scripts. It’s a fair point, somebody new to PowerShell will find it a little odd that they can’t just run a script found on the Internet – I find it reassuring.
On a newly installed PowerShell system, running a script will result in something like the following:
[D:\PsScripts]
1> & D:\PsScripts\test-scriptExecution1.ps1
File D:\PsScripts\test-scriptExecution1.ps1 cannot be loaded because the execution of scripts is disabled on this syste
m. Please see “get-help about_signing” for more details.
At line:1 char:38
+ D:\PsScripts\test-scriptExecution1.ps1 <<<<
The reason for this is the Execution Policy in place on the machine prevents all scripts from running by default. There are 4 Execute Policies defined in PowerShell, according to the help files, they are:
To control execution policies, PowerShell ships with a couple of cmdlets Get-ExecutionPolicy and Set-ExecutionPolicy. They basically do what they say on the tin:
2 Comments »
Filed under: PowerShell
I’m moving my blog away from Windows Live Spaces to CaptainLiteral.NET, so if anybody has subscribed to my feed, then you’d best update it to point at http://feeds.feedburner.com/CaptainLiteral. I’ve also set-up a FeedBurner thing for my RSS, so people won’t be hit by changes in the future.
Why Captain Literal? The guys as work call me Captain Literal because lunchtime conversations’ can go something like this:
Dan: “You can’t reboot a computer on a plane, it’ll crash,” followed by a hand movement to indicate that a plane would fall from the sky.
Mark (aka Captain Literal): “That’s why life-critical systems such as planes have multiple fail-safe’s on them. The space shuttle for example has multiple computers and they all vote on what’s going to happen. You could reboot one of those with no problems and the shuttle wouldn’t spiral off into outer-space.”
So that’s it, I have been nick-named Captain Literal and now Mark really is CaptainLiteral.NET.
Before I go out on a rant and document why I’m moving away from Spaces, I first need to thank Ashleigh (http://www.nakedcleaner.com) for firstly, hosting CaptainLiteral.NET. Secondly, for forcing me to setup CaptainLiteral.NET. And thirdly, for spending time last night actually setting up CaptainLIteral.NET – thanks Ashleigh.
And now for the fun bit – why am I leaving Windows Live Spaces?
Live Spaces has some things that merely annoying – these are the things that one can live with. But it also has some things that are very annoying – things that, when realised, encourage you to drop Windows Live Spaces and go look for some other blog provisioning service or friend to host for you.
1 Comment »
Filed under: Blog