Welcome to the Chocolatey Community Package Repository! The packages found in this section of the site are provided, maintained, and moderated by the community.
Moderation
Every version of each package undergoes a rigorous moderation process before it goes live that typically includes:
- Security, consistency, and quality checking
- Installation testing
- Virus checking through VirusTotal
- Human moderators who give final review and sign off
More detail at Security and Moderation.
Organizational Use
If you are an organization using Chocolatey, we want your experience to be fully reliable. Due to the nature of this publicly offered repository, reliability cannot be guaranteed. Packages offered here are subject to distribution rights, which means they may need to reach out further to the internet to the official locations to download files at runtime.
Fortunately, distribution rights do not apply for internal use. With any edition of Chocolatey (including the free open source edition), you can host your own packages and cache or internalize existing community packages.
Disclaimer
Your use of the packages on this site means you understand they are not supported or guaranteed in any way. Learn more...
- Passing
- Failing
- Pending
- Unknown / Exempted

Downloads:
23,154
Downloads of v 1.0.10:
1,417
Last Update:
30 Jul 2015
Package Maintainer(s):
Software Author(s):
- SEEK Ltd.
Tags:
admin DSC- Software Specific:
- Software Site
- Software License
- Package Specific:
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download

SEEK DSC Networking
- Software Specific:
- Software Site
- Software License
- Package Specific:
- Package outdated?
- Package broken?
- Contact Maintainers
- Contact Site Admins
- Software Vendor?
- Report Abuse
- Download
Downloads:
23,154
Downloads of v 1.0.10:
1,417
Maintainer(s):
Software Author(s):
- SEEK Ltd.
Edit Package
To edit the metadata for a package, please upload an updated version of the package.
Chocolatey's Community Package Repository currently does not allow updating package metadata on the website. This helps ensure that the package itself (and the source used to build the package) remains the one true source of package metadata.
This does require that you increment the package version.
Some Checks Have Failed or Are Not Yet Complete
1 Test Unknown and 1 Passing Test
To install SEEK DSC Networking, run the following command from the command line or from PowerShell:
To upgrade SEEK DSC Networking, run the following command from the command line or from PowerShell:
To uninstall SEEK DSC Networking, run the following command from the command line or from PowerShell:
NOTE: This applies to both open source and commercial editions of Chocolatey.
1. Ensure you are set for organizational deployment
Please see the organizational deployment guide
2. Get the package into your environment-
Open Source or Commercial:
- Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://chocolatey.org/api/v2. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
- You can also just download the package and push it to a repository Download
-
Open Source
- Download the Package Download
- Follow manual internalization instructions
-
Package Internalizer (C4B)
- Run
choco download seek-dsc-networking --internalize --source=https://chocolatey.org/api/v2
(additional options) - Run
choco push --source="'http://internal/odata/repo'"
for package and dependencies - Automate package internalization
- Run
3. Enter your internal repository url
(this should look similar to https://chocolatey.org/api/v2)
4. Choose your deployment method:
choco upgrade seek-dsc-networking -y --source="'STEP 3 URL'" [other options]
See options you can pass to upgrade.
See best practices for scripting.
Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.
If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:
choco upgrade seek-dsc-networking -y --source="'STEP 3 URL'"
$exitCode = $LASTEXITCODE
Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
Exit 0
}
Exit $exitCode
- name: Ensure seek-dsc-networking installed
win_chocolatey:
name: seek-dsc-networking
state: present
version: 1.0.10
source: STEP 3 URL
See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.
Coming early 2020! Central Managment Reporting available now! More information...
chocolatey_package 'seek-dsc-networking' do
action :install
version '1.0.10'
source 'STEP 3 URL'
end
See docs at https://docs.chef.io/resource_chocolatey_package.html.
Chocolatey::Ensure-Package
(
Name: seek-dsc-networking,
Version: 1.0.10,
Source: STEP 3 URL
);
Requires Otter Chocolatey Extension. See docs at https://inedo.com/den/otter/chocolatey.
cChocoPackageInstaller seek-dsc-networking
{
Name = 'seek-dsc-networking'
Ensure = 'Present'
Version = '1.0.10'
Source = 'STEP 3 URL'
}
Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.
package { 'seek-dsc-networking':
provider => 'chocolatey',
ensure => '1.0.10',
source => 'STEP 3 URL',
}
Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.
salt '*' chocolatey.install seek-dsc-networking version="1.0.10" source="STEP 3 URL"
See docs at https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.chocolatey.html.
5. If applicable - Chocolatey configuration/installation
See infrastructure management matrix for Chocolatey configuration elements and examples.
This package was approved as a trusted package on 30 Jul 2015.
Custom DSC Resources for networking administration
<# NOTE: This SSL certificate request module is designed for Local Dev machines ONLY !!! #>
<#
Retrieves a SSL certificate for a Subject located on machine
#>
function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$Subject,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$CertPath
)
Write-Verbose "Getting CERT"
$theCert = Get-ChildItem -path $CertPath | Where-Object {$_.Subject -eq $Subject}
#find the certificate and return
$certResult = @{
Subject = $Cert.Subject
Ensure = "Present"
SANs = $Cert.DnsNameList
OnlineCA = $Cert.Issuer
}
return $certResult
}
<#
Creates a SSL certificate for a Subject on machine if Present is ensured.
Removes SSL certificate for a Subject on machine if Absent is ensured.
#>
function Set-TargetResource
{
[CmdletBinding()]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$Subject,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$CertPath,
[ValidateSet("Present", "Absent")]
[string]$Ensure = "Present",
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String[]]$SANs,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$OnlineCA
)
Write-Verbose "Setting CERT"
if($Ensure -eq "Present")
{
Write-Verbose "Creating CERT for $Subject"
#call certreq
$subjectDomain = $Subject.split(',')[0].split('=')[1]
if ($subjectDomain -match "\*.") {
$subjectDomain = $subjectDomain -replace "\*", "star"
}
$CertificateINI = "$subjectDomain.ini"
$CertificateREQ = "$subjectDomain.req"
$CertificateRSP = "$subjectDomain.rsp"
$CertificateCER = "$subjectDomain.cer"
### INI file generation
new-item -type file $CertificateINI -force
add-content $CertificateINI '[Version]'
add-content $CertificateINI 'Signature="$Windows NT$"'
add-content $CertificateINI ''
add-content $CertificateINI '[NewRequest]'
$temp = 'Subject="' + $Subject + '"'
add-content $CertificateINI $temp
add-content $CertificateINI 'Exportable=TRUE'
add-content $CertificateINI 'KeyLength=2048'
add-content $CertificateINI 'KeySpec=1'
add-content $CertificateINI 'KeyUsage=0xA0'
add-content $CertificateINI 'MachineKeySet=True'
add-content $CertificateINI 'ProviderName="Microsoft RSA SChannel Cryptographic Provider"'
add-content $CertificateINI 'ProviderType=12'
add-content $CertificateINI 'RequestType=CMC'
add-content $CertificateINI ''
add-content $CertificateINI '[RequestAttributes]'
add-content $CertificateINI 'CertificateTemplate="WebServer"'
add-content $CertificateINI ''
add-content $CertificateINI '[EnhancedKeyUsageExtension]'
add-content $CertificateINI 'OID=1.3.6.1.5.5.7.3.1'
add-content $CertificateINI ''
if ($SANs) {
add-content $CertificateINI '[Extensions]'
add-content $CertificateINI '2.5.29.17 = "{text}"'
foreach ($SAN in $SANs) {
$temp = '_continue_ = "dns=' + $SAN + '&"'
add-content $CertificateINI $temp
}
}
try
{
### Certificate request generation
if (test-path $CertificateREQ) {
del $CertificateREQ
}
Write-Verbose "Converting $CertificateINI to CSR: certreq -new $CertificateINI $CertificateREQ"
certreq -new $CertificateINI $CertificateREQ
### Online certificate request and import
if ($OnlineCA) {
if (test-path $CertificateCER) {del $CertificateCER}
if (test-path $CertificateRSP) {del $CertificateRSP}
Write-Verbose "Submitting: certreq -submit -config $OnlineCA $CertificateREQ $CertificateCER"
certreq -submit -config $OnlineCA $CertificateREQ $CertificateCER
Write-Verbose "Merging certificate response file and CSR together to generate SSL certificate: certreq -accept -config $OnlineCA $CertificateCER"
certreq -accept -config $OnlineCA $CertificateCER
}
Write-Verbose "Finished creating CERT for $Subject"
}
catch
{
$errorId = "CertReqFailure";
$errorCategory = [System.Management.Automation.ErrorCategory]::InvalidOperation;
$errorMessage = "CertGenerationFailure -f ${Name}";
$exception = New-Object System.InvalidOperationException $errorMessage ;
$errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null
$PSCmdlet.ThrowTerminatingError($errorRecord)
}
Test-TargetResource $Subject $CertPath $Ensure $SANs $OnlineCA
}
else
{
Write-Verbose "Removing CERT for $Subject"
$theCert = Get-ChildItem -path $CertPath | Where-Object {$_.Subject -eq $Subject}
if ($theCert -ne $null)
{
$Thumbprint = $theCert.Thumbprint
Remove-Item -Path "$CertPath\$Thumbprint"
Write-Verbose "Successfully removed CERT for $Subject"
}
}
}
<#
Tests a SSL certificate for a Subject IS located on machine if Present is ensured.
Tests a SSL certificate for a Subject IS NOT located on machine if Absent is ensured.
#>
function Test-TargetResource
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$Subject,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$CertPath,
[ValidateSet("Present", "Absent")]
[string]$Ensure = "Present",
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String[]]$SANs,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$OnlineCA
)
Write-Verbose "Testing CERT"
#test that the cert is there
$theCert = Get-ChildItem -path $CertPath | Where-Object {$_.Subject -eq $Subject}
if ($theCert -ne $null -and $Ensure -eq "Present")
{
Write-Verbose "CERT Thumbprint is $theCert"
Write-Verbose "CERT is expected to be Present and is Present"
return $true
}
if ($theCert -eq $null -and $Ensure -eq "Absent")
{
Write-Verbose "CERT is expected to be Absent and is Absent"
return $true
}
return $false
}
# FUNCTIONS TO BE EXPORTED
Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource
function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$Name
)
try
{
$advFirewallOutput = (Invoke-NetshAdvFirewall -Name $Name -Operation "show")
$firewallRuleExists = $advFirewallOutput -match "Rule Name:\s+$Name\s+"
}
catch
{
$firewallRuleExists = $false
}
if (-not $firewallRuleExists)
{
return @{
Name = $Name
Direction = $null
LocalPort = $null
Protocol = $null
Action = $null
Ensure = "Absent"
}
}
if ($advFirewallOutput -match "Direction:\s+(.+?)\s+")
{
$direction = switch ($Matches[1])
{
"in" {"Inbound"}
"out" {"Outbound"}
}
}
if ($advFirewallOutput -match "LocalPort:\s+(.+?)\s+")
{
$localport = $Matches[1]
}
if ($advFirewallOutput -match "Protocol:\s+(.+?)\s+")
{
$protocol = $Matches[1]
}
if ($advFirewallOutput -match "Action:\s+(.+?)\s+")
{
$action = $Matches[1]
}
return @{
Name = $Name
Direction = $direction
LocalPort = $localPort
Protocol = $protocol
Action = $action
Ensure = "Present"
}
}
function Set-TargetResource
{
[CmdletBinding(DefaultParameterSetName = "Absent")]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$Name,
[parameter(Mandatory=$true,ParameterSetName = "Present")]
[ValidateSet("Inbound","Outbound")]
[System.String]$Direction,
[parameter(Mandatory=$true,ParameterSetName = "Present")]
[ValidateNotNullOrEmpty()]
[System.String]$LocalPort,
[parameter(Mandatory=$true,ParameterSetName = "Present")]
[ValidateSet("TCP","UDP")]
[System.String]$Protocol,
[parameter(Mandatory=$true,ParameterSetName = "Present")]
[ValidateSet("Allow","Block", "Bypass")]
[System.String]$Action,
[parameter(Mandatory=$false,ParameterSetName = "Present")]
[parameter(Mandatory=$true,ParameterSetName = "Absent")]
[ValidateSet("Present","Absent")]
[System.String]
$Ensure = "Present"
)
if ($Ensure -eq "Present")
{
New-NetFirewallRule -Name $Name `
-Direction $Direction `
-LocalPort $LocalPort `
-Protocol $Protocol `
-Action $Action
}
else
{
Remove-NetFirewallRule -Name $Name
}
}
function Test-TargetResource
{
[CmdletBinding(DefaultParameterSetName = "Absent")]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$Name,
[parameter(Mandatory=$true,ParameterSetName = "Present")]
[ValidateSet("Inbound","Outbound")]
[System.String]$Direction,
[parameter(Mandatory=$true,ParameterSetName = "Present")]
[ValidateNotNullOrEmpty()]
[System.String]$LocalPort,
[parameter(Mandatory=$true,ParameterSetName = "Present")]
[ValidateSet("TCP","UDP")]
[System.String]$Protocol,
[parameter(Mandatory=$true,ParameterSetName = "Present")]
[ValidateSet("Allow","Block", "Bypass")]
[System.String]$Action,
[parameter(Mandatory=$false,ParameterSetName = "Present")]
[parameter(Mandatory=$true,ParameterSetName = "Absent")]
[ValidateSet("Present","Absent")]
[System.String]
$Ensure = "Present"
)
$firewallRule = Get-TargetResource -Name $Name
if ($Ensure -eq "Absent" -and $firewallRule.Ensure -eq "Absent")
{
return $true
}
if ($Ensure -eq "Present" `
-and $firewallRule.Ensure -eq "Present" `
-and $firewallRule.Direction -eq $Direction `
-and $firewallRule.LocalPort -eq $LocalPort `
-and $firewallRule.Protocol -eq $Protocol `
-and $firewallRule.Action -eq $Action)
{
return $true
}
return $false
}
function New-NetFirewallRule
{
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Name,
[String]$Protocol,
[String]$LocalPort,
[ValidateSet("Inbound", "Outbound")]
[String]$Direction,
[ValidateSet("Allow", "Block", "Bypass")]
[String]$Action
)
Invoke-NetshAdvFirewall -Name $Name `
-Operation "add" `
-Protocol $Protocol `
-LocalPort $LocalPort `
-Direction $Direction `
-Action $Action
}
function Remove-NetFirewallRule
{
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Name
)
Invoke-NetshAdvFirewall -Name $Name -Operation "del"
}
function Invoke-NetshAdvFirewall
{
[CmdletBinding()]
[OutputType([System.String])]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Name,
[parameter(Mandatory = $true)]
[ValidateSet("add","del","show")]
[String]$Operation,
[String]$Protocol,
[String]$LocalPort,
[ValidateSet("Inbound", "Outbound")]
[String]$Direction,
[ValidateSet("Allow", "Block", "Bypass")]
[String]$Action
)
$argumentList = @(
'advfirewall', 'firewall', $Operation, 'rule',
"name=""${Name}"""
)
if ($Direction)
{
$dir = switch ($Direction)
{
"Inbound" {"in"}
"Outbound" {"out"}
}
$argumentList += "dir=$dir"
}
if ($Protocol)
{
$argumentList += "protocol=$Protocol"
}
if ($LocalPort)
{
$argumentList += "localport=$LocalPort"
}
if ($Action)
{
$argumentList += "action=$Action"
}
$outputPath = "${env:TEMP}\netsh.out"
$process = Start-Process netsh -ArgumentList $argumentList -Wait -NoNewWindow -RedirectStandardOutput $outputPath -Passthru
if ($process.ExitCode -ne 0) { throw "Error performing operation '$Operation' for firewall rule"}
return ((Get-Content $outputPath) -join "`n")
}
Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource
<#######################################################################################
# MSDSCPack_IPAddress : DSC Resource that will set/test/get the current IP
# Address, by accepting values among those given in MSDSCPack_IPAddress.schema.mof
#######################################################################################>
######################################################################################
# The Get-TargetResource cmdlet.
# This function will get the present list of IP Address DSC Resource schema variables on the system
######################################################################################
function Get-TargetResource
{
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$IPAddress,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$NodeName
)
Write-Warning "SEEK_cIPAddress resource is obsolete, please use SEEK_cStaticIpAddress"
$returnValue = @{
}
$returnValue
}
######################################################################################
# The Set-TargetResource cmdlet.
# This function will set a new IP Address in the current node
######################################################################################
function Set-TargetResource
{
param
(
#IP Address that has to be set
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$IPAddress,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$NodeName
)
Write-Warning "SEEK_cIPAddress resource is obsolete, please use SEEK_cStaticIpAddress"
ValidateProperties @PSBoundParameters
}
######################################################################################
# The Test-TargetResource cmdlet.
# This will test if the given IP Address is among the current node's IP Address collection
######################################################################################
function Test-TargetResource
{
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$IPAddress,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$NodeName
)
Write-Warning "SEEK_cIPAddress resource is obsolete, please use SEEK_cStaticIpAddress"
$result = ValidateProperties @PSBoundParameters
if ($result -eq $false)
{
$errorId = "WebsiteBindingConflictOnStart";
$errorCategory = [System.Management.Automation.ErrorCategory]::InvalidResult
$errorMessage = "IPAddress $IPAddress not found..."
$exception = New-Object System.InvalidOperationException $errorMessage
$errorRecord = New-Object System.Management.Automation.ErrorRecord $exception, $errorId, $errorCategory, $null
$PSCmdlet.ThrowTerminatingError($errorRecord);
}
$result
}
#######################################################################################
# Helper function that validates the IP Address properties. If the switch parameter
# "Apply" is set, then it will set the properties after a test
#######################################################################################
function ValidateProperties
{
param
(
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$IPAddress,
[Parameter(Mandatory)]
[ValidateNotNullOrEmpty()]
[String]$NodeName,
[Switch]$Apply
)
$ip = $IPAddress
if(!([System.Net.Ipaddress]::TryParse($ip, [ref]0)))
{
throw "IP Address *$IPAddress* is not in the correct format. Please correct the ipaddress in the configuration and try again"
}
try
{
#Write-Verbose -Message "Checking the IPAddress ..."
$Networks = Get-WmiObject Win32_NetworkAdapterConfiguration -ComputerName $NodeName | ? {$_.IPEnabled}
foreach($Network in $Networks)
{
if ($Network.IPAddress.Contains($IPAddress))
{
return $true
break;
}
}
Write-Verbose -Message "IPAddressFound $IPAddressFound"
return $false
}
catch
{
Write-Verbose -Message $_
throw "Can not set or find valid IPAddress using InterfaceAlias $InterfaceAlias and AddressFamily $AddressFamily"
}
}
# FUNCTIONS TO BE EXPORTED
Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource
# NOTE: Supports IPv4 addresses only
function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$IpAddress
)
$networkAdapterConfiguration = Get-NetworkAdapterConfigurationByIpAddress $IpAddress
if ($networkAdapterConfiguration -eq $null)
{
return @{
IpAddress = $IpAddress
Interface = $null
SubnetMask = $null
DHCPEnabled = $null
Ensure = "Absent"
}
}
$networkAdapter = Get-NetworkAdapterByIndex $networkAdapterConfiguration.Index
$ipAddressList = $networkAdapterConfiguration.IPAddress | Where-IPv4Address
$ipSubnetList = $networkAdapterConfiguration.IPSubnet | Where-IPv4Subnet
$ipAddressIndex = $ipAddressList.IndexOf($IpAddress)
return @{
IpAddress = $IpAddress
Interface = $networkAdapter.NetConnectionID
SubnetMask = @($ipSubnetList)[$ipAddressIndex]
DHCPEnabled = $networkAdapterConfiguration.DHCPEnabled
Ensure = "Present"
}
}
function Set-TargetResource
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$IpAddress,
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$Interface,
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$SubnetMask,
[ValidateSet("Present","Absent")]
[System.String]
$Ensure = "Present"
)
if(!([System.Net.Ipaddress]::TryParse($IpAddress, [ref]0))) { throw "IP Address ""$IpAddress"" is invalid"}
if(!([System.Net.Ipaddress]::TryParse($SubnetMask, [ref]0))) { throw "SubnetMask ""$SubnetMask"" is invalid"}
if ($Ensure -eq "Absent")
{
Remove-IpAddress -IpAddress $IpAddress -Interface $Interface
}
else
{
Add-IpAddress -IpAddress $IpAddress -Interface $Interface -SubnetMask $SubnetMask
}
}
function Test-TargetResource
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$IpAddress,
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$Interface,
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$SubnetMask,
[ValidateSet("Present","Absent")]
[System.String]
$Ensure = "Present"
)
$existingIpAddress = Get-TargetResource $IpAddress
if ($Ensure -eq "Present" -and `
$existingIpAddress -ne $null -and `
$existingIpAddress.Interface -eq $Interface -and `
$existingIpAddress.SubnetMask -eq $SubnetMask -and `
$existingIpAddress.Ensure -eq $Ensure -and `
$existingIpAddress.DHCPEnabled -eq $false)
{
return $true
}
elseif ($Ensure -eq "Absent" -and `
$existingIpAddress.Ensure -eq $Ensure)
{
return $true
}
return $false
}
function Add-IpAddress
{
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$IpAddress,
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$Interface,
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$SubnetMask
)
$networkAdapterConfiguration = Get-NetworkAdapterConfigurationByInterface $Interface
if (Test-IpAddressBound -IpAddress $IpAddress -Index $networkAdapterConfiguration.Index -SubnetMask $SubnetMask) { return }
if (Test-IpAddressBound $IpAddress)
{
Remove-IpAddress -IpAddress $IpAddress
}
$ipAddressList = $networkAdapterConfiguration.IPAddress + @($IpAddress) | Where-IPv4Address
$ipSubnetList = $networkAdapterConfiguration.IPSubnet + @($SubnetMask) | Where-IPv4Subnet
Enable-Static -NetworkAdapterConfiguration $networkAdapterConfiguration `
-IpAddresses $ipAddressList `
-IpSubnets $ipSubnetList
}
function Remove-IpAddress
{
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$IpAddress,
[parameter(Mandatory = $false)]
[System.String]$Interface = $null
)
$networkAdapterConfiguration = $null
if ($Interface)
{
$networkAdapterConfiguration = Get-NetworkAdapterConfigurationByInterface $Interface
}
else
{
$networkAdapterConfiguration = Get-NetworkAdapterConfigurationByIpAddress $IpAddress
}
$ipAddressList = [System.Collections.ArrayList]@($networkAdapterConfiguration.IPAddress | Where-IPv4Address)
$ipSubnetList = [System.Collections.ArrayList]@($networkAdapterConfiguration.IPSubnet | Where-IPv4Subnet)
$ipAddressIndex = $ipAddressList.IndexOf($IpAddress)
if ($ipAddressIndex -lt 0) {return}
$ipAddressList.RemoveAt($ipAddressIndex)
$ipSubnetList.RemoveAt($ipAddressIndex)
if ($ipAddressList.Length -gt 0)
{
Enable-Static -NetworkAdapterConfiguration $networkAdapterConfiguration `
-IpAddresses ([Object[]]$ipAddressList) `
-IpSubnets ([Object[]]$ipSubnetList)
}
else
{
# Adapter is no longer bound to any IP addresses
# Reverting adapter to DHCP
Enable-DHCP -NetworkAdapterConfiguration $networkAdapterConfiguration
}
}
function Where-IPv4Address
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
[String]
$InputObject
)
process
{
if ($InputObject -notmatch ":")
{
Write-Output $InputObject
}
}
}
function Where-IPv4Subnet
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true, ValueFromPipeline = $true)]
[String]
$InputObject
)
process
{
if ($InputObject -match "\d+\.\d+\.\d+\.\d+")
{
Write-Output $InputObject
}
}
}
function Get-NetworkAdapterByIndex
{
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[Int32]$Index
)
$networkAdapter = Get-WmiObject Win32_NetworkAdapter | ? {$_.Index -eq $Index}
$results = $networkAdapter | measure
if ($results.count -le 0)
{
throw "Could not find a network adapter with index ""$Index"""
}
elseif ($results.count -gt 1)
{
$matchingAdapters = ($networkAdapter | % Path) -join ", "
throw "Multiple network adapters match the index ""$Index"" {$matchingAdapters}"
}
return ($networkAdapter | Select-Object -First 1)
}
function Get-NetworkAdapterByInterface
{
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$Interface
)
$networkAdapter = Get-WmiObject Win32_NetworkAdapter | ? {$_.NetConnectionID -eq $Interface}
$results = $networkAdapter | measure
if ($results.count -le 0)
{
throw "Could not find a network adapter matching ""$Interface"""
}
elseif ($results.count -gt 1)
{
$matchingAdapters = ($networkAdapter | % Path) -join ", "
throw "Multiple network adapters match the interface ""$Interface"" {$matchingAdapters}"
}
return ($networkAdapter | Select-Object -First 1)
}
function Get-NetworkAdapterConfigurationByInterface
{
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$Interface
)
$networkAdapter = Get-NetworkAdapterByInterface $Interface
return (Get-WmiObject Win32_NetworkAdapterConfiguration | ? {$_.Index -eq $networkAdapter.Index} | Select-Object -First 1)
}
function Get-NetworkAdapterConfigurationByIpAddress
{
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$IpAddress
)
$networkAdapterConfiguration = Get-WmiObject Win32_NetworkAdapterConfiguration | ? {$_.IPAddress -contains $IpAddress}
$results = $networkAdapterConfiguration | measure
if ($results.count -gt 1)
{
$matchingAdapters = ($networkAdapterConfiguration | % Path) -join ", "
throw "IP Address ""$IpAddress"" is bound to multiple network adapters {$matchingAdapters}"
}
return ($networkAdapterConfiguration | Select-Object -First 1)
}
function Test-IpAddressBound
{
[OutputType([Boolean])]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String]$IpAddress,
[parameter(Mandatory = $false)]
[ValidateNotNullOrEmpty()]
[Int32]$Index,
[parameter(Mandatory = $false)]
[ValidateNotNullOrEmpty()]
[System.String]$SubnetMask
)
$networkAdapterConfiguration = Get-WmiObject Win32_NetworkAdapterConfiguration | ? {$_.IPAddress -contains $IpAddress}
if ($Index)
{
$networkAdapterConfiguration = $networkAdapterConfiguration | ? {$_.Index -eq $Index}
}
if ($SubnetMask)
{
$networkAdapterConfiguration = $networkAdapterConfiguration | ? {$_.IPSubnet[$_.IPAddress.IndexOf($IpAddress)] -eq $SubnetMask}
}
$results = $networkAdapterConfiguration | measure
if ($results.count -le 0) { return $false } else { return $true }
}
function Enable-Static
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String[]]$IpAddresses,
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[System.String[]]$IpSubnets,
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[Object]$NetworkAdapterConfiguration
)
$result = $NetworkAdapterConfiguration.EnableStatic($IpAddresses, $IpSubnets)
if ($result.ReturnValue -ne 0) { throw "Failed to enable static IP addresses on network adapter with index ""$($NetworkAdapterConfiguration.Index)"" {$($IpAddresses -join ", ")}"}
}
function Enable-DHCP
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[Object]$NetworkAdapterConfiguration
)
$result = $NetworkAdapterConfiguration.EnableDHCP()
if ($result.ReturnValue -ne 0) { throw "Failed to enable DHCP on network adapter with index ""$($NetworkAdapterConfiguration.Index)"""}
}
Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource
function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Protocol = "http",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Hostname = "*",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Port
)
$url = Get-Url $Protocol $Hostname $Port
$urlAclOutput = (Invoke-NetshUrlAcl -Protocol $Protocol -Operation "show" -Url $url)
$urlReservationExists = $urlAclOutput -match "User:\s(.+?)\s"
if (!$urlReservationExists)
{
return @{
Protocol = $Protocol
Hostname = $Hostname
Port = $Port
User = $null
Ensure = "Absent"
}
}
$user = $Matches[1]
return @{
Protocol = $Protocol
Hostname = $Hostname
Port = $Port
User = $user
Ensure = "Present"
}
}
function Set-TargetResource
{
[CmdletBinding(DefaultParameterSetName = "Absent")]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Protocol = "http",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Hostname = "*",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Port,
[parameter(Mandatory=$true,ParameterSetName = "Present")]
[ValidateNotNullOrEmpty()]
[String]$User,
[parameter(Mandatory=$false,ParameterSetName = "Present")]
[parameter(Mandatory=$true,ParameterSetName = "Absent")]
[ValidateSet("Present","Absent")]
[System.String]
$Ensure = "Present"
)
if ($Ensure -eq "Present")
{
New-UrlReservation -Protocol $Protocol -Hostname $Hostname -Port $Port -User $User
}
else
{
Remove-UrlReservation -Protocol $Protocol -Hostname $Hostname -Port $Port
}
}
function Test-TargetResource
{
[CmdletBinding(DefaultParameterSetName = "Absent")]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Protocol = "http",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Hostname = "*",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Port,
[parameter(Mandatory=$true,ParameterSetName = "Present")]
[ValidateNotNullOrEmpty()]
[String]$User,
[parameter(Mandatory=$false,ParameterSetName = "Present")]
[parameter(Mandatory=$true,ParameterSetName = "Absent")]
[ValidateSet("Present","Absent")]
[System.String]
$Ensure = "Present"
)
$urlReservation = Get-TargetResource -Protocol $Protocol -Hostname $Hostname -Port $Port
if ($Ensure -eq "Absent" -and $urlReservation.Ensure -eq "Absent")
{
return $true
}
if ($Ensure -eq "Present" `
-and $urlReservation.Ensure -eq "Present" `
-and $urlReservation.Protocol -eq $Protocol `
-and $urlReservation.Hostname -eq $Hostname `
-and $urlReservation.Port -eq $Port `
-and $urlReservation.User -eq $User)
{
return $true
}
return $false
}
function New-UrlReservation
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Protocol = "http",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Hostname = "*",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Port,
[ValidateNotNullOrEmpty()]
[String]$User
)
$url = Get-Url $Protocol $Hostname $Port
Invoke-NetshUrlAcl -Protocol $Protocol -Operation "add" -Url $url -User $User
}
function Remove-UrlReservation
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Protocol = "http",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Hostname = "*",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Port
)
$url = Get-Url $Protocol $Hostname $Port
Invoke-NetshUrlAcl -Protocol $Protocol -Operation "del" -Url $url
}
function Get-Url
{
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Protocol = "http",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Hostname = "*",
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Port
)
return "${Protocol}://${Hostname}:${Port}/"
}
function Invoke-NetshUrlAcl
{
[CmdletBinding()]
[OutputType([System.String])]
param
(
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Protocol = "http",
[parameter(Mandatory = $true)]
[ValidateSet("add","del","show")]
[String]$Operation,
[parameter(Mandatory = $true)]
[ValidateNotNullOrEmpty()]
[String]$Url,
[String]$User
)
$argumentList = @(
$Protocol, $Operation, 'urlacl',
"url=""${Url}"""
)
if ($user)
{
$argumentList += "user=""${User}"""
}
$outputPath = "${env:TEMP}\netsh.out"
$process = Start-Process netsh -ArgumentList $argumentList -Wait -NoNewWindow -RedirectStandardOutput $outputPath -Passthru
if ($process.ExitCode -ne 0) { throw "Error performing operation '${Operation}' for reserved url"}
return ((Get-Content $outputPath) -join "`n")
}
Export-ModuleMember -function Get-TargetResource, Set-TargetResource, Test-TargetResource
try
{
$DSCResourcesRoot = Join-Path $env:ProgramFiles "WindowsPowerShell\Modules"
$DSCResourceTarget = Join-Path $env:chocolateyPackageFolder "lib"
# remove DSC resources that may have been manually installed
if (Test-Path "$DSCResourcesRoot\SEEK - Modules") {
cmd /c rmdir "$DSCResourcesRoot\SEEK - Modules"
}
Get-ChildItem $DSCResourceTarget | Foreach-Object {
if (Test-Path "$DSCResourcesRoot\$_") {
# remove previous installation of this package
cmd /c rmdir "$DSCResourcesRoot\$_"
}
cmd /c mklink /j "$DSCResourcesRoot\$_" "$DSCResourceTarget\$_"
Get-ChildItem -Path "$DSCResourcesRoot\$_" -File -Recurse | Unblock-File
}
} catch {
$host.SetShouldExit(1)
throw $_.Exception
}
try
{
$DSCResourcesRoot = Join-Path $env:ProgramFiles "WindowsPowerShell\Modules"
$DSCResourceTarget = Join-Path $env:chocolateyPackageFolder "lib"
Get-ChildItem $DSCResourceTarget | Foreach-Object { cmd /c rmdir "$DSCResourcesRoot\$_" }
} catch {
throw $_.Exception
}
Log in or click on link to see number of positives.
In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).
Chocolatey Pro provides runtime protection from possible malware.
Version | Downloads | Last Updated | Status |
---|---|---|---|
SEEK DSC Networking 2.0.0-alpha9 | 347 | Thursday, July 30, 2015 | Approved |
SEEK DSC Networking 2.0.0-alpha7 | 316 | Friday, May 1, 2015 | Approved |
SEEK DSC Networking 2.0.0-alpha6 | 317 | Wednesday, April 22, 2015 | Approved |
SEEK DSC Networking 2.0.0-alpha5 | 327 | Tuesday, April 21, 2015 | Approved |
SEEK DSC Networking 2.0.0-alpha4 | 288 | Tuesday, April 21, 2015 | Approved |
SEEK DSC Networking 2.0.0-alpha2 | 307 | Tuesday, February 24, 2015 | Approved |
SEEK DSC Networking 2.0.0-alpha1 | 304 | Monday, February 23, 2015 | Approved |
SEEK DSC Networking 1.0.10 | 1417 | Thursday, July 30, 2015 | Approved |
SEEK DSC Networking 1.0.9-alpha6 | 313 | Tuesday, June 9, 2015 | Approved |
SEEK DSC Networking 1.0.9-alpha5 | 283 | Tuesday, June 9, 2015 | Approved |
SEEK DSC Networking 1.0.9-alpha4 | 246 | Tuesday, June 9, 2015 | Approved |
SEEK DSC Networking 1.0.9-alpha3 | 306 | Tuesday, May 26, 2015 | Approved |
SEEK DSC Networking 1.0.9-alpha2 | 297 | Tuesday, May 26, 2015 | Approved |
SEEK DSC Networking 1.0.9-alpha1 | 291 | Friday, May 22, 2015 | Approved |
SEEK DSC Networking 1.0.4 | 369 | Friday, May 1, 2015 | Approved |
SEEK DSC Networking 1.0.3 | 330 | Wednesday, April 22, 2015 | Approved |
SEEK DSC Networking 1.0.2 | 277 | Tuesday, April 21, 2015 | Approved |
SEEK DSC Networking 1.0.0.87 | 463 | Sunday, February 22, 2015 | Approved |
SEEK DSC Networking 1.0.0.77 | 335 | Sunday, January 25, 2015 | Approved |
SEEK DSC Networking 1.0.0.76 | 311 | Wednesday, January 14, 2015 | Approved |
SEEK DSC Networking 1.0.0.75 | 528 | Tuesday, December 2, 2014 | Approved |
SEEK DSC Networking 1.0.0.74 | 389 | Sunday, November 9, 2014 | Approved |
SEEK DSC Networking 1.0.0.73 | 295 | Friday, November 7, 2014 | Approved |
SEEK DSC Networking 1.0.0.72 | 295 | Thursday, November 6, 2014 | Approved |
SEEK DSC Networking 1.0.0.71 | 284 | Thursday, November 6, 2014 | Approved |
SEEK DSC Networking 1.0.0.70 | 289 | Thursday, November 6, 2014 | Approved |
SEEK DSC Networking 1.0.0.69 | 312 | Monday, November 3, 2014 | Approved |
SEEK DSC Networking 1.0.0.68 | 293 | Monday, November 3, 2014 | Approved |
SEEK DSC Networking 1.0.0.67 | 270 | Monday, November 3, 2014 | Approved |
SEEK DSC Networking 1.0.0.64 | 298 | Thursday, October 30, 2014 | Approved |
SEEK DSC Networking 1.0.0.63 | 289 | Thursday, October 30, 2014 | Approved |
SEEK DSC Networking 1.0.0.62 | 311 | Monday, October 27, 2014 | Approved |
SEEK DSC Networking 1.0.0.61 | 307 | Friday, October 24, 2014 | Approved |
SEEK DSC Networking 1.0.0.60 | 277 | Friday, October 24, 2014 | Approved |
SEEK DSC Networking 1.0.0.59 | 277 | Friday, October 24, 2014 | Approved |
SEEK DSC Networking 1.0.0.58 | 295 | Friday, October 24, 2014 | Approved |
SEEK DSC Networking 1.0.0.55 | 305 | Friday, October 24, 2014 | Approved |
SEEK DSC Networking 1.0.0.54 | 334 | Wednesday, October 15, 2014 | Approved |
SEEK DSC Networking 1.0.0.53 | 309 | Wednesday, October 15, 2014 | Approved |
SEEK DSC Networking 1.0.0.52 | 276 | Wednesday, October 15, 2014 | Approved |
SEEK DSC Networking 1.0.0.51 | 304 | Wednesday, October 15, 2014 | Approved |
SEEK DSC Networking 1.0.0.50 | 313 | Sunday, October 12, 2014 | Approved |
SEEK DSC Networking 1.0.0.48 | 287 | Friday, October 10, 2014 | Approved |
SEEK DSC Networking 1.0.0.47 | 256 | Friday, October 10, 2014 | Approved |
SEEK DSC Networking 1.0.0.46 | 289 | Friday, October 10, 2014 | Approved |
SEEK DSC Networking 1.0.0.45 | 297 | Thursday, October 9, 2014 | Approved |
SEEK DSC Networking 1.0.0.43 | 293 | Wednesday, October 8, 2014 | Approved |
SEEK DSC Networking 1.0.0.42 | 244 | Wednesday, October 8, 2014 | Approved |
SEEK DSC Networking 1.0.0.41 | 258 | Thursday, October 2, 2014 | Approved |
SEEK DSC Networking 1.0.0.40 | 304 | Thursday, September 25, 2014 | Approved |
SEEK DSC Networking 1.0.0.39 | 281 | Thursday, September 25, 2014 | Approved |
SEEK DSC Networking 1.0.0.37 | 252 | Wednesday, September 24, 2014 | Approved |
SEEK DSC Networking 1.0.0.36 | 276 | Monday, September 22, 2014 | Approved |
SEEK DSC Networking 1.0.0.35 | 283 | Monday, September 15, 2014 | Approved |
SEEK DSC Networking 1.0.0.34 | 282 | Monday, September 15, 2014 | Approved |
SEEK DSC Networking 1.0.0.33 | 224 | Monday, September 15, 2014 | Approved |
SEEK DSC Networking 1.0.0.32 | 301 | Thursday, September 11, 2014 | Approved |
SEEK DSC Networking 1.0.0.31 | 236 | Wednesday, September 10, 2014 | Approved |
SEEK DSC Networking 1.0.0.30 | 278 | Wednesday, September 10, 2014 | Approved |
SEEK DSC Networking 1.0.0.29 | 269 | Wednesday, September 10, 2014 | Approved |
SEEK DSC Networking 1.0.0.28 | 276 | Tuesday, September 9, 2014 | Approved |
SEEK DSC Networking 1.0.0.27 | 278 | Tuesday, September 9, 2014 | Approved |
SEEK DSC Networking 1.0.0.20 | 267 | Tuesday, September 9, 2014 | Approved |
SEEK DSC Networking 1.0.0.19 | 291 | Tuesday, September 9, 2014 | Approved |
SEEK DSC Networking 1.0.0.18 | 309 | Tuesday, September 9, 2014 | Approved |
SEEK DSC Networking 1.0.0.17 | 291 | Tuesday, September 9, 2014 | Approved |
SEEK DSC Networking 1.0.0.13 | 281 | Friday, September 5, 2014 | Approved |
SEEK DSC Networking 1.0.0.11 | 267 | Friday, September 5, 2014 | Approved |
SEEK DSC Networking 1.0.0 | 298 | Tuesday, September 9, 2014 | Approved |
SEEK DSC Networking 0.0.0.1 | 247 | Tuesday, May 5, 2015 | Approved |
© 2015 SEEK Ltd. All rights reserved.
This package has no dependencies.
Ground Rules:
- This discussion is only about SEEK DSC Networking and the SEEK DSC Networking package. If you have feedback for Chocolatey, please contact the Google Group.
- This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
- The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
- Tell us what you love about the package or SEEK DSC Networking, or tell us what needs improvement.
- Share your experiences with the package, or extra configuration or gotchas that you've found.
- If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.