param(
    $type,
    $scopeid
)
Try {
if ($type -eq 'discover') {
		$Dhcpv4scopes = (Get-DhcpServerv4Scope).scopeid.ipaddresstostring

		write-host "[" 
		foreach ($Dhcpv4scope in $Dhcpv4scopes) {
			
			$Str1 = '{"DHCPv4Scope":"'
			$Str2 = '"},'
		$str1+$Dhcpv4scope+$str2
		}
		write-host '{"DHCPv4Scope":"DumbScope"}'
		write-host "]"
		}
if ($type -eq 'status') {
		$freeips = Get-DhcpServerv4ScopeStatistics -ScopeId $scopeid
		$freeips.free
		}
}
catch {
	write-host "[" 
	write-host '{"DHCPv4Scope":"DumbScope"}'
	write-host "]"
}
