Here is a great article on documenting sql databases using powershell.
This could easily be turned into a full database compare tool which would be ideal for testing database upgrade scripts (or for detecting the need for them).
Random outpourings of a software developer
Here is a great article on documenting sql databases using powershell.
This could easily be turned into a full database compare tool which would be ideal for testing database upgrade scripts (or for detecting the need for them).
This is a powershell version of get-service that works across remote machines (provided that you have sufficient access to the box).
function Get-ServiceRemote($computerName = “.”)
{
Get-WmiObject win32_service -ComputerName . | sort Name | select SystemName,State,Name,DisplayName
}
This can be passed through ft -Auto to become more readable.
A few scripts like these could be of great use in checking the state of a remote system.
Here is a powershell declarative language that can be used to check deployments.
I have been trying to work out how to interact with RabbitMQ via Powershell.
I have seen PoshRabbit but that is not quite flexible enough for my purposes. I am looking for simple admin tasks.
The obvious starting point is the excellent RabbitMQ.Client assembly.
The only flaw is that the ConnectionFactory is not common type system safe due to a pair of properties that are not case unique. However with a bit of reflection even this can be overcome. Here is my first draft of the Send example in powershell:
[Reflection.Assembly]::LoadFile(($pwd).Path + “RabbitMq.Client.Dll”)
$factory = new-object RabbitMQ.Client.ConnectionFactory
$hostNameProp = [RabbitMQ.Client.ConnectionFactory].GetField(“HostName”)
$hostNameProp.SetValue($factory, “localhost”)
$createConnectionMethod = [RabbitMQ.Client.ConnectionFactory].GetMethod(“CreateConnection”, [Type]::EmptyTypes)
$connection = $createConnectionMethod.Invoke($factory, “instance,public”, $null, $null, $null)
$channel = $connection.CreateModel()
$channel.QueueDeclare(“hello”, $false, $false, $false, $null)
$message = “Hello, World!”
$body = [System.Text.Encoding]::UTF8.GetBytes($message)
$channel.BasicPublish(“”, “hello”, $null, $body)
Write-Host ” [x] Sent $message”
Now that I can create the connection the rest of the examples should be trivial to port.
To get powershell scripts to work without signing on a win 7 box:
Run cmd as admin.
Start powershell and run the following
Set-ExecutionPolicy Unrestricted
It seemed so obvious that someone has already done it:
http://www.dougfinke.com/blog/index.php/2010/08/04/odata-powershell-explorer/
This is a library of remote registry utilities for powershell.