NETSetup
Version: 0.7.0-proxmoxvms.697
Branch: feature/proxmoxvms
Tag: Autodeployed
Release Date: 08/18/2023 13:46:08
Purpose
NETSetup allows users to automtiaclly (or automagically) setup and configure any number of machines (servers, client computers, laptops) in a given organisation from OS installation, to server configuration, to domain joining of client computers, to software installation, all according to a given NETSetup configuration file.
In other words: NETSetup translates an enterprise structure to a network configuration and sets up the network accordingly.
In a future revision a new machine will receive its NETSetup automatically during its OOBE experience ("Just plug it in!"™).
Executable (Advanced Functions)
SHA-256 Hash of NETSetup.exe:
F4B11A40B7A403BDE626FD73DA2CBE327CE9F886622913074A3D8E6CA9997DE0
Usage
NETSetup.exe can install and configure aspects of a given machine. During a regular NETSetup installation it need not be downloaded seperately. The executable is provided here for advanced users.
Use "NETSetup.exe [command]" with one of the following commands:
-
ensure-file --file <filename> --dir <directory>:
Ensures that the file <filename> exists in the directory <directory>. If it does not yet exist, it will be downloaded from dropbox. Root for the --file parameter is Dropbox:\NETSetup\boot -
ensure-folder --folder <foldername> --dir <directory>:
Ensures that the folder <foldername> with all its contents exists in the directory <directory>. If it does not yet exist, it will be downloaded from dropbox. Root for the --folder parameter is Dropbox:\NETSetup\boot -
install Requires <driveroot>\NETSetup\config\config.json to be present, where <driveroot> is the current drive’s drive letter. Looks in <driveroot>\NETSetup\config\config.json for a configuration matching the machine’s serial number and uses it to update the machine to match the machine’s configuration (OS, software, domain, etc.).
-
set-ip --ip <ipaddress> --netmask <netmask> --gateway <geteway> --dns <dns>:
Sets the machine’s ip address to <ip-address> and changes netmask, gateway and dns to the entries provided. -
join-domain --domain <domain> --user <username> --password <password>:
Tries to join the machine to the domain <domain> with the user <username> and its password <password>. The user must include the NETBios-domain (e.g. osisa\user.name) -
get-id: Gets the machin’s BIOS serial number (SMBIOS).
-
get-md5 --file <filename>:
Gets the md5 hash of the file <filename>. -
get-sha --file <filename>:
Gets the sha256 hash of the file <filename>. -
get-crc --file <filename>:
Gets the crc-32 hash of the file <filename>. -
check-sha --file <filename> --sha <checksum>:
Checks that the sha256 checksum of the file <filename> matches the provides <checksum> -
reboot-oobe [--force [1|true]]: Reboots the machine to the OOBE environment after confirmation. Optionally use "--force 1" to skip confirmation. WARNING: Once the machine is in OOBE environment, the entire process must be finished before you can return to the regular desktop.
-
rename --name <name> [--force [1|true]]:
Renames the machine to <name>. Asks for confirmation unless "--force 1" is specified. WARNING: Using this while joined to a domain will mess up your system because the AD entry of your machine is not updated to match the new name. Leaving the domain will then be impossible because (presumably) no computer with the new name <name> exists in the domain. -
wlan --ssid <ssid> --password <password>:
Tries to connect your wifi to the ntwork with the SSID <ssid> using the password <password>.
Examples:
.\NETSetup.exe set-ip --ip 192.168.1.123 --netmask 255.255.255.0 --gateway 192.168.1.1 --dns 8.8.8.8
.\NETSetup.exe get-sha c:\temp\document.docx
.\NETSetup.exe wlan --ssid swisscom --password abcd-1234-efgh-5678-ijkl
.\NETSetup.exe install
NETSetup: USB Stick
Requirements for Installation using NETSetup USB Stick
-
Target machine’s serial number has to be associated to a specific configuration.
-
Physical access to the machine, which has power, display and a keyboard connected.
-
An USB Stick of at least 16 GB (This USB Stick will be formatted and all data on it will be lost).
-
The tool Rufus is installed (you can install it now with chocolatey: type "choco install rufus -y" in an elevated Powershell).
-
The NETSetup.iso is in the folder "C:\NETSetup\". You can download it now.
SHA-256 Hash of NETSetup.iso:
D09647253F055A8937B63B0C5549618A5DB1FCB5B4A0A0597426E90AA2215C70
Read the entire document once from start to end before doing anything.
Making the USB Stick
-
Plug in your USB Stick to your computer
-
Open rufus.
-
Select your USB Stick from the list at the top ("Laufwerk"):
-
Click the "AUSWAHL" button and select the C:\NETSetup\NETSetup.iso file.
-
Make sure that the following Items are set as expected:
-
"Partitionsschema" is set to "GPT"
-
"Zielsystem" is set to "UEFI (ohne CSM)"
-
"Dateisystem" is set to "NTFS"
-
-
Click the "START" button.
-
Rufus will show you a Popup. Make sure that none of the checkboxes are activated and click "OK".
-
Rufus will show you a warning. Click "OK".
-
Wait for the green progress bar at the bottom of the program to fill. This is a good time to get a cup of coffee.
-
Rufus will show the text "FERTIG" in the filled progress bar once it is done. You can unplug and use the NETSetup USB Stick now and you can close rufus.
Using the USB Stick
-
Plug the USB Stick in the target machine.
-
Power on the machine and hold down the F9 key until you enter the boot menu.
-
Use the arrow keys to select your USB stick. If your USB Stick shows up more than once, pick the topmost occurence.
-
The target machine will install automatically. Wait for the installation to finish.
Note: If you’re setting up a new Windows Server Domain/AD, wait for the server to finish all its tasks before installing the clients. ~30min should be enough for reasonably up to date hardware. Connect the new machines to the LAN and boot them the same way with the USB Stick from before or a differnt one that has been made the same way
Troubleshooting
-
I get an error while creating the USB stick:
=> Ensure that the USB stick is working and that it has enough space.
-
I cannot enter the boot menu:
=> Disable "Fast Boot" in the BIOS. Consult Google if you are unsure on how to do this.
-
The NETSetup fails unexpectedly:
=> Ensure that you have the correct NETSetup.iso file.
=> Make sure you follow the directions in <<Using the USB Stick>> correctly and ensure that the target machine's serial number is correctly registered in the config.
-
Windows Server installation fails:
=> Windows Server installation REQUIRES to be connected to an ethernet environment (a router is enough, it doesn't have to be a complete internet-activated environment with multiple machines). If there is no response on the ethernet port while installing, Windows Server will not install and setup ethernet and it will fail.
Developer Info
When you push changes to the NETSetup repository, the corresponding Git Action tests, builds, and updates the executable and the ISO-Image automatically.
NETSetup Process
actor Agent as Agent (public) actor Ticketing as Ticketing (public) actor Accounting as Accounting (private) actor NETSetup as NETSetup (private) actor Supplier as Supplier (Alltron) actor Provider as Provider (Dropbox) actor Computer actor SWVendor as Software Vendor (Microsoft) actor HWVendor as Hardware Vendor (HP) Customer ->> Agent: callAgent() -> new order Agent ->> Ticketing: createNETSetupTicket(order) -> new ticket Ticketing ->> Customer: notifyCustomer(ticket) Agent ->> Customer: requestCurrentMode(ticket) -> ensureConfig(ticket.customer.currentMode) Customer ->> Agent: responseCurrentMode(ticket) -> updateConfig(updatedCurrentMode) Agent ->> Customer: requestFutureMode(updatedCurrentMode.config) Customer ->> Agent: responseFutureMode(updatedCurrentMode.config) -> futureMode.config Agent ->> Accounting: createQuote(updatedCurrentMode.config, futureMode.config) -> new quote Accounting ->> Agent: returnQuote(quote) Agent ->> Customer: sendQuote(quote) Customer ->> Agent: responseQuote(quote) Agent ->> Supplier: createOrder(quote) -> new order Supplier ->> Agent: return order.Success Agent ->> NETSetup: createConfigs(ticket, futureMode.config) -> new config[] Note over Agent,NETSetup: someConfig[] = { {HASTAG}ticket.json, ... } NETSetup ->> Provider: save config[] Provider ->> NETSetup: return save.Success NETSetup ->> Agent: return save.Sucess Supplier ->> Agent: return order.HardwareHashes Agent ->> NETSetup: updateConfigs(ticket, hardwareHashes) Note over Agent,NETSetup: someConfig[] = { serial.name{HASHTAG}ticket.map, serial2.name2{HASHTAG}ticket.map, ... } NETSetup ->> Provider: updateConfigs(ticket, hardwareHashes) Provider ->> NETSetup: return update.Success NETSetup ->> Agent: return update.Sucess Supplier ->> Customer: deliverOrder(setup) Agent ->> NETSetup: Use Rufus to flash NETSetup.iso to USB Stick NETSetup ->> Agent: NETSetup ready USB Stick loop For every computer Agent ->> Computer: plugIn(Power, USB Stick, Display, Keyboard) Agent ->> Computer: turnOn() Agent ->> Computer: hold(F9 or other key to get into Boot Menu) Agent ->> Computer: select(USB Stick) Computer ->> Computer: tries to boot USB Stick alt if Can boot NTFS Partition Computer ->> Computer: Boots WinPE from NTFS Partition else else Lacks NTFS Driver Computer ->> Computer: Boots FAT32 NTFS Driver Computer ->> Computer: Boots WinPE from NTFS Partition end Computer ->> Computer: WinPE runs startnet.cmd Computer ->> Computer: startnet.cmd searches every drive for autoexecute.ps1 Computer ->> Computer: cd to drive and run autoexecute.ps1 Computer ->> NETSetup: autoexecute.ps1 runs NETSetup.exe NETSetup ->> Computer: executionEnvironment = CheckInstallationRequirements() NETSetup ->> Computer: CheckIfElevatedElseExit(executionEnvironment) %%NETSetup ->> Computer: testValue = Read(TestInstallation.txt)%% %%NETSetup ->> Computer: config = config.OverrideSerialNumberIfInputNotEmpty(testValue)%% NETSetup ->> Computer: online = CheckResolveHostname(google.com) alt if online NETSetup ->> Provider: configs = ensureConfigs() end NETSetup ->> Computer: serial = Computer.getSerial() NETSetup ->> NETSetup: currentConfig = getCurrentConfig(serial) alt if no config available NETSetup ->> Agent: listAvailableTickets() Agent ->> NETSetup: selectTicket(ticketNumber) NETSetup ->> NETSetup: Renameconfig(ticketNumber, serial) NETSetup ->> NETSetup: currentConfig = getCurrentConfig(serial) end NETSetup ->> Computer: TryInstallDrivers(machine.Manufacturer.Name) NETSetup ->> Computer: TryInstallDrivers(machine.Model.Name) alt if online NETSetup ->> Computer: EnsureNewestImage(operatingSystem) end NETSetup ->> Computer: targetDrive = GetLargestFixedDrive() alt if operatingSystem.Contains(Windows) NETSetup ->> Computer: CopyNETSetupFolderToImage(operatingSystem) NETSetup ->> Computer: CurrentDirectory = Images\\operatingSystem NETSetup ->> Computer: unattended = unattended.Replace(DISKID, targetDrive.Index) NETSetup ->> Computer: StartProcess(setup.exe /unattend) NETSetup ->> Computer: Reboot() Computer ->> Computer: Boots Windows Setup from targetDrive Computer ->> Computer: Windows auto setup via unattend.xml Computer ->> Computer: Add scheduled Task to run NETSetup Computer ->> Computer: Reboot() Computer ->> Computer: Boots Windows from targetDrive Computer ->> NETSetup: Run NETSetup NETSetup ->> Computer: DomainJoin(currentConfig.Domain), ... else else operatingSystem.Contains(Linux) NETSetup ->> Computer: targetDrive.CreateLinuxPartitions() NETSetup ->> Computer: targetDrive.CopyEverythingToNewPartitions() NETSetup ->> Computer: BIOS.DeactivateSecureBoot() NETSetup ->> Computer: BIOS.DeactivateFastBoot() NETSetup ->> Computer: BIOS.BootDriveFirst(targetDrive) NETSetup ->> Computer: Reboot() Computer ->> Computer: Boots GRUB Boot Manager Computer ->> Computer: Boots Void Linux Computer ->> Computer: Run /etc/profile Computer ->> NETSetup: Run /efi/netsetup/autoexecute.sh NETSetup ->> Computer: Partition Drive NETSetup ->> Computer: Format Drive NETSetup ->> Computer: Unpack Linux Image.tar.gz NETSetup ->> Computer: Mount Image NETSetup ->> Computer: Update BootEntry NETSetup ->> Computer: Umount Image NETSetup ->> Computer: Reboot() end end Customer ->> Agent: fillOut(config.approvalForm)
Linux
how to extract tar.gz
gunzip -t proxmox.tar.gz
how to extract squashed image to valid image
unsquashfs -x -f squashfs.img LiveOS/ext3fs.img -d void
delte previous file to ensure no error there
sudo rm squashfs.img
if not yet make new folder /mnt
mkdir /mnt
mount image locally to mnt/void
sudo mount -o loop squashfs-root/LiveOS/ext3fs.img /mnt/void
modify files on the image, eg:
sudo nvim /mnt/void/etc/profile
or even enter the image as if you booted it with
sudo chroot /mnt/void
unmount when done
sudo umount /mnt/void
and then repack the image
sudo mksquashfs squashfs-root squashfs.img
only good way to style bash shell / terminal btw
export PS1="[ \[\e[31m\]\u\[\e[m\]@\[\e[36m\]\H\[\e[m\]: \[\e[33m\]\w\[\e[m\] ] \[\e[36m\]\t\[\e[m\] \[\e[31m\]\\$\[\e[m\] "