USB ethernet adapter mac(s) for imaging multiple hosts. (Universal Imaging Nics) (Wired Nic for All Wireless Devices)
-
I have quite a few non-ethernet devices, and it’s a growing number.
Yes, we have more and more users with devices not having an onboard NIC and therefore we want to handle this properly.
A more dynamic and or integrated solution would be great, but I get that having the service use uuid and eventually phasing out the MAC addresses as a registration entity is that solution and that it will take some time. If there’s anything I can do to help with that, I would love to contribute.
Absolutely, this is what we are aiming for. I will get back to you on this I am sure!
PS: About the API cmdlet. You should talk to @Wayne-Workman who’s working on a native Linux API cmd thing.
-
@jj-fullmer I’m writing a fog-cli using Python3, which can run on any OS. You’re of course welcome to keep going down the powershell path, but for the Python3 based project your talents would certainly be appreciated and your welcome to help.
-
@wayne-workman I’m certainly more fluent in powershell, but I know some python.
Where might I find a git repo or other place to see what you got.
Maybe I’ll still make my powershell module but do it in something of a port style and match any functions you create to give users options.Just playing with my little invoke-api cmdlet function I posted here I’ve been able to easily create so many more functions and functionalities. I imagine python has similar rest methods built in that create objects and such.
-
@jj-fullmer In case anyone is wanting to play with this further. Here’s another function to get the current host or get a host by a given uuid, mac, or hostname.
function Get-FogHost { [CmdletBinding()] param ( [string]$uuid, [string]$hostName, [string]$macAddr ) begin { [bool]$found = $false; Write-Verbose 'Checking for passed variables' if (!$uuid -and !$hostName -and !$macAddr) { Write-Verbose 'no params given, getting current computer variables'; $uuid = (Get-WmiObject Win32_ComputerSystemProduct).UUID; $macAddr = ((Get-NetAdapter | Select-Object MacAddress)[0].MacAddress).Replace('-',':'); $hostName = $(hostname); } Write-Verbose 'getting all hosts to search...'; $hosts = (Invoke-FogApi).hosts; Write-Verbose "search terms: uuid is $uuid, macAddr is $macAddr, hostname is $hostName"; } process { Write-Verbose 'finding host in hosts'; $hostObj = $hosts | Where-Object { ($uuid -ne "" -AND $_.inventory.sysuuid -eq $uuid) -OR ` ($hostName -ne "" -AND $_.name -match $hostName) -OR ` ($macAddr -ne "" -AND $_.macs -contains $macAddr); if ($uuid -ne "" -AND $_.inventory.sysuuid -eq $uuid) { Write-Verbose "$($_.inventory.sysuuid) matches the uuid $uuid`! host found"; $found = $true; } if ($hostName -ne "" -AND $_.name -match $hostName) { Write-Verbose "$($_.name) matches the hostname $hostName`! host found"; $found = $true; } if ($macAddr -ne "" -AND $_.macs -contains $macAddr) { Write-Verbose "$($_.macs) matches the macaddress $macAddr`! host found"; $found = $true; } } } end { if ($found){ return $hostObj; } return $found; #return false if host not found } }
-
@jj-fullmer said in USB ethernet adapter mac(s) for imaging multiple hosts. (Universal Imaging Nics) (Wired Nic for All Wireless Devices):
current host or get a host by a given uuid, mac, or hostname.
You should fork the fog-community-scripts repository and add this stuff to it. Just label it the powershell cli or something, give it some snazzy name.
For the Python project, I’m calling it fog-cli.