Client Management Suite

 View Only

PCPUtil -- Python Client Policy Utility 

Oct 29, 2010 12:28 PM

I created PCPUtil over a lunch break to address a problem I had seen the same morning with an NS agent install. The agent wasn't ever receiving any sub-agents or policies. After some searching on the SymWISE page I came across a few articles that described the error I was seeing of the client being unable to obtain policies and throwing an error when you try to fetch the policies via a web browser. If you look at this SymWISE article it discusses how to retrieve the client policy for a computer using your browser. The URL in the HOWTO is crazy long since there's a bit of XML in the URL. PCPUtil attempts to simplify this a bit by offering you a way to just input the name of your NS server and the GUID (with {braces}) of the computer you want to fetch the policies for.

Usage

PCPUtil requires Python 2.6 or greater. Prior versions of Python lack support for the string.format() method it's using. If you want to check your Python version mac/*nix you can fire up a terminal and do:

python --version

On Windows you're going to have to download and install Python, 2.7 is the latest version. You'll also want to add the install path (which defaults to C:\Python27) to your System $PATH so that you can call 'python' from anywhere. If you're unsure of how to add python to your system path, google can probably help you out. Usage is going to look like this:

C:\> python PCPUtil.py NSServerName {GUID GOES HERE}

Please note: All platforms will need the BeautifulSoup module. You can find it at the python package index (cheese shop) or if you have setuptools running you can just do 'easy_install beautifulsoup'

Results

The results by default are going to just spit out into the command prompt or terminal. This is fine if you're looking for the short [CDATA] error that's just a few lines long but a valid response will spin for 5-10 seconds spitting out guids and such. You can send the output to a file if you would prefer just by using the standard Windows/Mac/*nix > or >> like so:

C:\> python PCPUtil.py NSServerName {GUID} > C:\policies.txt

Closing Thoughts

This could very easily be modified to use a hardcoded NS name or to add support for reading an input file containing multiple guids so you can fetch the output of a list of machines fairly easily. Also don't forget on mac/*nix this can be used with grep, sed, and awk. Below you can see an example from my macbook using the GUID of my win7 laptop:

cal@redacted$: python PCPUtil.py AltiriNSServer {99DDBF01-4164-42A2-8B1B-BDEFAF66ABE2} | grep wusa.exe
        <![CDATA[wusa.exe Windows6.1-kb978886-x64.msu /quiet /norestart]]>
        <![CDATA[wusa.exe windows6.1-kb979687-x64.msu /quiet /norestart]]>
        <![CDATA[wusa.exe Windows6.1-KB983590-x64.msu /quiet /norestart]]>
        <![CDATA[wusa.exe windows6.1-kb982132-x64.msu /quiet /norestart]]>

You can see this spit out some of the patches to be applied to that particular machine.

 

Enjoy!!!
 

Statistics
0 Favorited
0 Views
1 Files
0 Shares
0 Downloads
Attachment(s)
zip file
PCPUtil.zip   627 B   1 version
Uploaded - Feb 25, 2020

Tags and Keywords

Related Entries and Links

No Related Resource entered.