PowerShell and Telnet.

I've got a backlog of posts at the moment. Steve and I have been getting ready for the Road-show, and Windows deployment services, System Center Virtual Machine Manager, Virtual Server Clustering, iScsi, dual booting Windows Server 2003 & 2008, and Windows Server Virtualization mean I could be hunch over the keyboard and Windows Live writer for hours.

I've been writing Scripts for OCS and one of the issues I've had to deal with has been remoting .It's easy enough to remotely connect to a WMI object but I can't seem to create a new instance of an object.
This code will get me the Installed OCS components on another machine

 Get-WmiObject -query "select * from MSFT_SIPServerInstalledComponentData"-computername $server -credential $user 

and this function will add a new server to a list maintained by OCS.

 function New-OCSEdgeInternalServer
{Param([String]$IntServer=$(throw "You must specify an interal Server"))
 $oInstance=([wmiclass]"\\.\root\cimv2:MSFT_SIPFederationInternalServerData").createinstance()
 $oInstance.InternalServer= $IntServer
 $oInstance.put() | out-null
}

However the put fails if the \\.\root\cimv2 path is changed to \\serverName\root\cimv2

PS in telnet Running PowerShell on the machine your sitting at, in order to manage a remote machine seems OK, but it does seem like some things are best run with PowerShell on the remote machine. Of course one can use Terminal services but this seems a bit heavy so I thought I would enable the Telnet service and try running PowerShell on the remote box from a Telnet Client. It works, including things which might not be too nice on a terminal: scrolling back through previous commands, tab completion and so on. The telnet client isn't quite as smart with its handling of colours as it appears in the screen shot below, and Telnet is out of favour because too much flows round the network in plain text. But that's not the point, it's another way to get a result. Now I'm trying to invent a scenario where you'd want to manage Virtual Machines, by issuing PowerShell commands in a telnet window !

 

 

Technorati tags: Microsoft, Virtual Server, Windows Server 2008, powershell