Private/Set-CustomNetworkSettings.ps1

# Will be called in VM
function Global:Set-CustomNetworkSettings {
    [CmdletBinding()]
    <#
    .SYNOPSIS
        ...
    .DESCRIPTION
        ...
    #>

    param(        
    )
    process {        
        if ((Get-WmiObject win32_computersystem).partofdomain -eq $false) { 
            #Write-Host "Restarting Network Location Awareness-service..."
            #Get-Service -Name NLASVC | Restart-Service
            #Write-Host "Done."
            Write-Host "Restarting Network Setup Service-service..."
            Get-Service -Name NetSetupSvc | Restart-Service -Force
            Write-Host "Done."
            Start-Sleep -Seconds 15
            foreach ($netConProfile in Get-NetConnectionProfile | Where-Object { $_.InterfaceAlias -like 'Ethernet*' }) {
                if ($netConProfile.NetworkCategory -ne 'Private') {
                    Write-Host "Changing networtk to Private..."
                    Set-NetConnectionProfile -Name $netConProfile.Name -NetworkCategory Private
                    Write-Host "Done."

                    Write-Host "Restarting Network Location Awareness-service..."
                    Get-Service -Name NLASVC | Restart-Service -Force
                    Write-Host "Done."
                    Start-Sleep -Seconds 15
                    $true
                }
            }            
        }
        else {
            $false
        }
        <#
        foreach ($profile in Get-NetConnectionProfile | Where-Object {$_.InterfaceAlias -like 'Ethernet*'}){
            Set-DnsClientServerAddress -InterfaceIndex $profile.InterfaceIndex -ServerAddresses ("10.0.0.4") # TODO: Change to DC IP
        }
        #>

    }
}