As I've been working more and more with PowerShell, I've discovered a few gaps in coverage in the cmdlets it offers. Most of my PowerShell noodling has been with Exchange 2007, so represents holes in the Exchange Management Shell extensions, but the one I just ran across is basic PowerShell.
PowerShell provides a series of cmdlets for querying and manipulating Windows Services, among them New-Service, Set-Service, and Get-Service:
- New-Service, of course, allows me to create a new service instance, including setting dependencies and credentials.
- With Set-Service I can change various parameters associated with a service: its display name, description, and startup type (Automatic, Manual, or Disabled). However, I can't change its credentials or dependencies.
- Get-Service is the most disappointing. It doesn't return the startup type parameter, so even though I can return an arbitrary list of services (using built-in rich wildcard support for service names and our friend the where cmdlet to sift through other parameters) I can't tell whether my returned services are set to automatically run or not!
This makes it pretty difficult to use native PowerShell to (say) write a quick script to capture the status of a set of services for later retrival, then shut them down and set them to Disabled for a time. If I were able to capture that status, I could use a second quick script that would use the saved settings and reset the services to their prior configuration. This script would then be generic and could be used in all sorts of situations. Instead, I get to hardwire stuff in or do it by hand.
The second major hole I've found so far is in the Exchange Management Shell extensions, in particular the Set-PublicFolder cmdlet. I've finally figured out the right syntax for specifying multiple servers for the -Replicas parameter, but it would have been really be nice if the cmdlet had distinct -AddReplicaTo and -RemoveReplicaFrom parameters. As it is now, if I'm making changes, I have to capture the existing list of replica databases, add or remove the desired entries, then feed the entire list back in to Set-PublicFolder. If I try to pass in a single database, I overwrite the existing value of Replicas. This may be acceptable for large-scale public folder operations, but it makes it a pain to do quick one-off operations.
This is matched by a minor gripe with Get-PublicFolder: when it displays the replicas in a table or list format, it displays only the database names. If I've named multiple public folder databases the same name (like, say, "Public Folders"), then I can't tell by inspecting this list which servers the replicas are on. I need to indulge in further script-foo to figure it out. Again, this makes casual administration from EMS much more of a chore than it should be.
Finally, I'd like to thank both the Exchange team and the PowerShell team for all the hard work they've done, both on the code and on the docs. My only complaint about the docs is that often there are not enough examples, especially when you have parameters whose use isn't immediately obvious (such as the -Replicas parameter for the Set-PublicFolder cmdlet).
Have you found a puzzling gap in cmdlet coverage? If so, let me know, and I'll start compiling a list.