Richard's profileRichard Siddaway's BlogPhotosBlogLists Tools Help

Richard Siddaway

Occupation
Location
Interests

Richard Siddaway's Blog

Of PowerShell and Other Things
June 30

out-gridview

The version of PowerShell that ships with Windows 7 RC has fixed out-gridview so that we can display more than 10 columns.

try

get-process | select * | Out-GridView

to test it

Technorati Tags: ,
June 28

AD PowerShell on Windows 2008/2003 - supposedly

As James pointed out recently the AD Web Service from Windows 2008 R2 has been released for Windows 2008 and Windows 2003 -  see http://blogs.msdn.com/adpowershell/archive/2009/06/23/use-active-directory-powershell-to-manage-windows-2003-2008-dcs.aspx for details.

Having installed it there doesn’t appear to be any sign of the AD cmdlets or Provider.  On this basis it is useless.  If anyone knows different please let me know because I’ve looked in all the logical (and illogical) and I can’t find those cmdlets.  The Windows 2008 R2 RSAT won’t install so that source doesn’t work.

June 25

Microsoft Learning Manager

I went on to the Microsoft site looking for books on SQL Server 2008.  What you get is an incomprehensible jumble of stuff.  Don’t tell me about everything there is – let me get to the information I want.

I used to really like the Microsoft site as there was masses of information that usually logically arranged.  Now we get some many layers between us and the information that I’m likely to expire of old age (OK I know its not that long to go) before finding it. 

Another example – I went looking for the information on the SQL Server exams – the logical route through the site leaves you with the impression there isn’t an upgrade from SQL 2005 MCITP to the 2008 version.  Wrong! But oh how you have to search.

I’m coming to the conclusion that the only way to access the Microsoft site is to search from outside and hope you can get to what you need.

A triumph of style over substance at the moment.

Technorati Tags:

SQL Server autoclose

Buck Woody blogged about SQL Server autoclose and how it should be set to being off  - http://blogs.msdn.com/buckwoody/archive/2009/06/24/sql-server-best-practices-autoclose-should-be-off.aspx 

I’m doing a lot with SQL Server and PowerShell at the moment and it started me thinking that I could easily set this property in PowerShell.

001
002
003
004
005
006
007
008
009
010
$Server = New-Object Microsoft.SqlServer.Management.Smo.Server("SQL08")
$Server.databases | select Name, Autoclose
foreach ($db in $Server.Databases){
    if (!$db.IsSystemObject){
        $db.Autoclose = $false
        $db.Alter()
    }
}
$Server = New-Object Microsoft.SqlServer.Management.Smo.Server("SQL08")
$Server.databases | select Name, Autoclose

 

Create a server object and display the databases, selecting name and the autoclose property.  Its boolean so we get true or false back.

We can iterate through the database collection. Test if the database is a system database and set autoclose to false (we don’t want autoclose to happen).  A call to Alter() saves the change.

Finally we can recreate the server object and  redisplay the autoclose property.

Technorati Tags: ,

PowerShell survey

The PowerShell team want to know how you find PowerShell related material – scripts, training material etc etc

http://blogs.msdn.com/powershell/archive/2009/06/24/new-powershell-survey-on-connect.aspx

Technorati Tags: