start-install.psm1

function start-install {
<#
    .NOTES
    =======================================
    Created by: Byran Schomburg
    Website: www.schomburg.dev
    =======================================
    .SYNOPSIS
    Runs the Get-WindowsAutopilotInfo Script with additions
    .DESCRIPTION
    This script sets the local administrator to something you would like in case LAPS doesnt work.
    Additionally you can set a primary DNS address for error free domain joins. The secondary DNS will be set to 8.8.8.8.
    After that the Script runs the normal Get-WindowsAutopilotInfo script.
    .INPUTS
    None, You can't pipe objects to start-install.
    .OUTPUTS
    None, start-install doesn't generate any output.
    .EXAMPLE
    PS> run-startup
#>
 
    set-executionpolicy Unrestricted
    $password = read-host "Password for local Admin" | ConvertTo-SecureString -AsPlainText -Force
    Enable-LocalUser Administrator
    Set-LocalUser -Name Administrator -Password $password -Verbose
    $index = get-netadapter -name ethernet
    $primaryDNS = read-host = "Primary DNS address"
    Set-DnsClientServerAddress -InterfaceIndex $index.InterfaceIndex -ServerAddresses ("$primaryDNS","8.8.8.8")
    Install-Script -Name Get-WindowsAutoPilotInfo -force
    Get-WindowsAutoPilotInfo -online -Assign -reboot}