PoSH4PlexApp is an in-development PowerShell module for querying and managing PlexApp libraries via Plex Media Server’s web listener, authored by Craig Taylor. This post provides the first release of the module along with some use notes.
[Read More...]-
PoSH4PlexApp – PowerShell module for managing Plex Media Server
-
Even MORE SCOM 2012 R2 Dashboard Fun with Multi-Pin Bing Maps
An enhancement of Tao Yang’s application of the SCOM 2012 R2 UR2 PowerShell Web Browser widget, leveraging Bing Maps. Facilitating support of multiple pins per map, surfacing of rich custom data and dynamic scaling. Contains challenge, summary of approach, screenshots and code solution. Intermediate PowerShell, covering loops, SCOM cmdlets, XML handling and counting incidence of substring inside a string.
[Read More...] -
Remote activation of Windows Server Licensing via PowerShell (sort of)
Commentated script providing a means of batch activating Virtual Machines and Physical servers using PowerShell and SCHTASKS.exe, circumventing the limitations of Invoke-Command when calling SLMGR.vbs. This script could easily be extended to work with other data-sources (Active Directory) or Hypervisors (vSphere via PowerCLI)
[Read More...] -
List SCVMM allocated IP addresses via PowerShell
An easily understood PowerShell pipeline for listing IP addresses allocated from SCVMM managed pools
[Read More...] -
Bulk enable disabled SCCM 2012 Programs using PowerShell
Enable disabled System Center 2012 programs en-masse via a very simple PowerShell pipeline.
[Read More...] -
Ping multiple computers in PowerShell
It came to my attention today that not everyone is spat out of the womb knowing how to test the network connection to a list of computers in PoSH. Some use cases for this one-liner could be…
- Testing guest connectivity on a set of vMotions/LiveMigrating VM’s
- ‘Monitoring’ the progress of automated/batch processes involving host restarts, for example VMware Update Manager host/guest patching
- Rudimentary confirmation of node system load when testing load-balanced farms, increased response time being a sign of significantly increased system pressure
It’s pretty easy to do this. The method relies on the ability of the Microsoft Management Powershell Module cmdlet, Test-Connection, to accept a comma-separated list of hostnames.
Example as follows:
Test-Connection -ComputerName TESTPC1,TESTPC2,TESTPC3 -Count 100
Example (redacted) output:
As you can see, the Test-Connection cmdlet is alternating between the three listed hosts. The output is superior to our good friend ping, exposing more data in a tabulated presentation with failed connections even coming up in attention-grabbing red text! The cmdlet has several handy switches outlined here. In case the power of having an honest-to-goodness queriable object pumped out by your connectivity verifier, rather than a string dump, is not self evident (think scripting scenarios people!), you can find a decent overview at the computerperformance.co.uk site.
-
Cloning an existing Security Group using Active Directory Powershell
Yesterday I came across a recurring scenario where a distribution group existed for a user set, but no security group. As we needed a security group for publishing an application to this user-set via our App-V management servers, I was driven to develop a quick AD single PoSH single liner (not single pipeline, sadly). It copies all the user object members of one group into another. Here it is!
$userstoclone = Get-ADGroup -filter {Name -like “Source Group”} | Get-ADGroupMember | Where-Object {$_.objectClass -eq “user”};ForEach ($user in $userstoclone){Add-ADGroupMember –Identity (Get-ADGroup -filter {Name -like “Target Group”}) -Members $user}
It wouldn’t take a world of imagination to change the filters so it could copy computer objects, group objects, recurse somewhat deeper etc.
Enjoy!
-
MMS 2012 related post: Powershell & SCVMM 2012 – an applied example
I decided to skip an MMS 2012 session on VMM to get some insight on how one would deploy App-V 5.0 as a current App-V 4.6 user.
That said – I can tell you now PoSH makes everything better, including VMM! On the flight back, I ‘ll type up a walk-through about, and even a refined version of, the generalized VMM & AD 2008R2 PoSH script I have uploaded and used in anger.
This script deploys a service template into a cloud the user defines, customizing the name of the guests to follow a convention, and moves the resultant associated AD Computer objects into target OU’s to allow appropriate Group Policy to take effect.
Why not define the naming convention in the service template using the BLAH## syntax you say? Well, we were deploying multiple instances of this service template in different geographies, so the naming convention had to be regionalised every time. Rather than having multiple different service template versions for each of the naming conventions (meaning we couldn’t perform vHW service changes through a single point, leading to more complex version control), I felt it was easier (longer term) just to define the names at the point of dropping a template in. Same applied for Tags, and descriptions which may need to be translated into the language of the region etc.
Script v0.1 on SkyDrive. A more gentle introduction to the script will follow.
-
PowerShell Function to return Computer objects nested within a base OU
I needed to gather the system volume sizes for all the servers on our estate as part of a scoping exercise for a Microsoft DPM project. It seemed to me that WMI was probably the answer, and a brief Bing search discovered this script.
However, I didn’t want to manually type out a text file to feed it computer names. Nor do I trust our CMDB to be up to date enough that I could use that as a reference point. Therefore, I used the best CMDB in our org, Active Directory. One brief coding scripting session resulted in the PowerShell function below, which will recurse though OU’s nested below a base OU, specified by it’s LDAP path in the initial function call and captures all discovered computer object name values to a string object. It can be easily modified to capture whatever property you are interested in, so feel free to use & abuse. Enjoy!
Function GetCompsToString
{param ($baseou)
$ou = [ADSI] “$baseou”
foreach ($child in $ou.psbase.Children )
{
if ($child.ObjectCategory -like ‘*computer*’) {$strComputer +=$child.Name}
Elseif ($child.ObjectCategory -like ‘*Organizational-Unit*’) {GetCompsToString $child.path}
}
return $strComputer
}
$input = “LDAP://OU=BaseOU,DC=DOMAIN,DC=LOCAL”
$output = GetCompsToString $input
Thanks to Joachimm Naslander (http://social.technet.microsoft.com/Forums/en/winserverManagement/thread/a0cebabf-3fc9-49b0-be55-5e4ff3232b7b) for the core method I used.
NOTE!: I aim to use some more easily parsed way to publish code, so this will be retroactively enhanced.
Recent Comments