Quantcast
Channel: Spiceworks Community - Latest topics
Viewing all articles
Browse latest Browse all 183785

PowerShell Assessment: Guidance

$
0
0

Dear Friends,

I've made a previous thread regarding this; but i can no longer find it.

For you see, I am a TAFE student currently studying in certificate four. And I've been given an assessment on PowerShell, that well; The teachers are of no use, and I'm in desperate need of help.

Let me be clear though, I'm not asking of you to solve it; or do the work for me, but to help put me in the right direction. And aid me in understanding the scripting language a bit better.

$DNS_IP = "192.168.1.2"
$DCHPNameServer = "HKLM:\System\CurrentControlSet\Services\Tcpip\Parameters\DhcpNameServer"
$Interfaces = "HKLM:\System\CurrentControlSet\Services\Tcpip\Parameters\Interfaces"

If (Test-Path -path $DCHPNameServer)
{
$DCHPRootResult = "Exists"
}
Else
{
$DCHPRootResult = "False"
}

$InterfaceLookup = Get-ChildItem $Interfaces
ForEach ($InterfaceLookup in $InterfaceLookup) {
       
        If (Get-ChildItem $InterfaceLookup\DhcpNameServer)
        {
        write-host "$InterfaceLookup"
        write-host "found"
        }
        Else
        {
        write-host "$InterfaceLookup"
        write-host "Nope"
        }
       

}

I'm stuck, and not sure how to check for the DCHP Name key. And then, check if it has a value.

Could you help me fix this up?


Viewing all articles
Browse latest Browse all 183785

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>