Wim-ms’s Opsmgr 2007 Weblog

A blog about opsmgr 2007

Powershell automation – take one

Posted by wim-ms on January 18, 2008

I’m from a unix/linux background, so that obviously means I’m GUI-challenged. That’s why I’ve took it upon myself to try to manage everything in Opsmgr with Powershell.

So, what is one of the first things you do when you’ve installed Opsmgr ? That’s right, installing agents.

First a bit of background: I’ve chosen ‘local system’ for the server action account, and I’m using a domain account with local admin rights for installing the agents. This works fine with the GUI, but a bit too much clicking/typing for me.

So off to powershell I went, with the ‘install-agent’ cmdlet and using an example from the scomshell blog

$creds = Get-Credential
# Define a WindowsDiscoveryConfiguration
$dconf = New-WindowsDiscoveryConfiguration –ComputerName: "dc1.tad.loc" –PerformVerification: $true –ActionAccount:$creds -ComputerType: "Server"
# Start the discovery process.
$result = Start-Discovery –ManagementServer (get-managementserver) –WindowsDiscoveryConfiguration $dconf
# Check that the discovery process discovered the Windows computers you specified.
# Last but not least install agents on the discovered computers.
Install-Agent –ManagementServer (get-managementserver) –AgentManagedComputer $result.CustomMonitoringObjects

Everything works fine until I get at the install-agent cmdlet, there’s no way of specifying any credentials, which means the cmdlet is trying to install the agents as ‘Local System’ which of course doesn’t work.

Anyone out there who has a solution for my problem ? or maybe I’m just doing something wrong, I’m from the unix side afterall.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: