CentOS 7 and OpenVPN 2.3.5 (Routed)

Decided to setup a openvpn server on a new CentOS 7 box and it was not exactly straight forward so below are the steps required, this should be enough to get started

On a (minimal) centOS 7 box:

yum -y install gcc rpm-build vim openssl-devel lzo-devel pam-devel wget
wget http://swupdate.openvpn.org/community/releases/openvpn-2.3.5.tar.gz
rpmbuild -tb openvpn-2.3.5.tar.gz

if using a seperate server for as the VPN server:

scp ./RPMS/x86_64/openvpn-2.3.5-1.x86_64.rpm server:/tmp

Read More

MSBuild and 7Zip SFX

The following allows you to package up your build output into a SFX file with custom properties that appear when someone right clicks the SFX and chooses properties.

Useful if you need to create a zip that can be signed but want your company/product information to appear on the SFX.EXE.

Read More

TFS queue build from powershell

I was doing some testing on TFS and got fed up queuing new builds via right-click -> queue new build -> ok. So here is a powershell script that can be used to kick off a build.

I’ve included some extra assemblies that don’t need to be used as I have other functions that do use them in the same module file. example useage below

Queue-TFSBuild -TFSServer http://tfsserver:8080/tfs/col -Project Project1 -Definition DailyBuild

$arrAssemblies = @(
    "Microsoft.TeamFoundation.Client",
    "Microsoft.TeamFoundation.Common",
    "Microsoft.TeamFoundation.Build.Client",
    "Microsoft.TeamFoundation.Build.Workflow",
    "Microsoft.TeamFoundation.VersionControl.Client"
)
Foreach ($assembly in $arrAssemblies) {
    [void][Reflection.Assembly]::LoadWithPartialName($assembly)
}	
Remove-Variable assembly, arrAssemblies


Function Queue-TFSBuild {
    [CmdLetBinding()]
    Param (
        [Uri]$TFSServer,
        [String]$Project,
        [String]$Definition
    )

    Process {
        [Microsoft.TeamFoundation.Client.TfsTeamProjectCollection]$tfsc = [Microsoft.TeamFoundation.Client.TfsTeamProjectCollectionFactory]::GetTeamProjectCollection($TFSServer)
        $IBS = [Microsoft.TeamFoundation.Build.Client.IBuildServer]

        [Microsoft.TeamFoundation.Build.Client.IBuildServer] $buildserver = $tfsc.GetService($IBS)
        [Microsoft.TeamFoundation.Build.Client.IBuildDefinition] $BuildDef = $buildserver.GetBuildDefinition($Project,$Definition)
        [Microsoft.TeamFoundation.Build.Client.IBuildRequest] $BuildReq = $BuildDef.CreateBuildRequest();
        $buildserver.QueueBuild($BuildReq)
    }
}

Get Numeric Values from an Enum in powershell

I needed to get the values for a enum in order to generate the correct flags for a function call here’s how to do it.

[Enum]::GetValues() will return a list of all the values

::.value__ will return the numeric value enum

[Enum]::GetValues([Microsoft.TeamFoundation.Build.Client.BuildStatus]) | foreach {
$Name = $_
$Value = ([Microsoft.TeamFoundation.Build.Client.BuildStatus]::$_).value__
Write-Output "$Name = $Value"
}

SCCM CDP to WMI version 0.0.0.3 out

Sorry for the lack of progress until recently but I’ve recently had a lot of more important priorities in life so working on this had to go on hold for a little while. I am hoping in the next few months to release version 1.0 but as on now this is still experimental so should only be used in a lab environment.

Please use the ticketing system on sourceforge to report any issues and add feature requests.

You can get it here: http://sourceforge.net/projects/cdptowmi/

ToDo:

See here: https://sourceforge.net/p/cdptowmi/wiki/ToDo%20List/ (work in progress)

Read More

TFS Warehouse Cube Status via SOAP and Powershell

Well I’ve just been put in charge of managing our TFS infrastructure so here is the first of hopefully many posts around automating and managing TFS.

The attached script runs a SOAP query against the TFS Warehouse Cube and returns the jobs and their status and then either generates an HTML file or sends an HTML email with the results.

I recommend creating a directory called Scripts on the C:\ drive and setting the permissions so that only the System Administrator & User the script runs as can access the contents of the directory.

Read More

Scripted checking of SCCM Backups

This is a script that parses the smsbkup.log and outputs results (in html) and the relevant portions of the file to the specified folder. The idea being that the with a small bit of tweaking you could have the report hosted on  a webserver to check or emailed (there will be a post on emailing in Powershell later) to you.

This is best run from the central primary under credentials that have access to the other sites.

Note: The script requires UNC paths for the $fpath variable as it is expecting be be run remotely.

Note2: This script was written for SCCM 2007 and not for SCCM 2012, however thanks to one of my readers, Satish, the following should fix that:
Change
if ($content | where {$_ -like "Backup task completed successfully*"}) {
to
if ($content | where{$_ -like "*SQL Backup task completed successfully*"}) {

Note3:
Potential Dates issues with SCCM 2012 R2. Thanks to Marius for the update.
Change
$cdate = $cdate.adddays($days) | get-date -format “ddd MMM dd”
to (this is probably US specific and will probably vary depending on locale)
$cdate = $cdate.adddays($days) | get-date -format “MM-dd-yyyy”

Read More

Programs without MSI Product ID

Recently I had an issue where ActiveSetup wasn’t installing some applications when deployed. It turned out that it was due to some of the packaged applications not having a program with the Windows installer information populated. As it was believed that this may not an isolated issues I was tasked with producing a report of all Packages where the information was missing. This is not actually possible via the default reports as none of the views exposed to SCCM actually contain this information. The only way to get this information is to query the SCCM database table “PkgPrograms”, and to do that and have a permenant report SSRS is needed as it can run with the credentials of the user generating it or with an execution account which may have more access.

Read More