Changing Network Category via Powershell

For enabling PowerShell remoting its necessary to use a private network instead of a public network. To enable this this nice powershell script from Microsoft can do the trick.

$NLMType = [Type]::GetTypeFromCLSID('DCB00C01-570F-4A9B-8D69-199FDBA5723B')
$INetworkListManager = [Activator]::CreateInstance($NLMType)

$NLM_ENUM_NETWORK_CONNECTED  = 1
$NLM_NETWORK_CATEGORY_PUBLIC = 0x00
$NLM_NETWORK_CATEGORY_PRIVATE = 0x01
$UNIDENTIFIED = "Unidentified network"

$INetworks = $INetworkListManager.GetNetworks($NLM_ENUM_NETWORK_CONNECTED)

foreach ($INetwork in $INetworks)
{
    $Name = $INetwork.GetName()
    $Category = $INetwork.GetCategory()

        $INetwork.SetCategory($NLM_NETWORK_CATEGORY_PRIVATE)

}

Application won’t download Content

In my previous post I had a script that creates the application. Everything looked fine but when trying to install SCCM could not find the source so it was thinking it was locally availble. Although I added content to the application it was missing content. Reason was that the object did not create a reference to the application. So the following lines should also be added to add content to the deployment type.

$newContentref  =  New-Object Microsoft.ConfigurationManagement.ApplicationManagement.ContentRef
$newContentref.ID  = $newApplicationContent.Id
$newDeploymentType.Installer.InstallContent =  $newContentref