FogApi
2408.9.2
This essentially gives you a crossplatform commandline interface for fog tasks and makes many things easier to automate.
The documentation is hosted on readthedocs at https://fogapi.readthedocs.io/en/latest/
To install this module you need at le
This essentially gives you a crossplatform commandline interface for fog tasks and makes many things easier to automate.
The documentation is hosted on readthedocs at https://fogapi.readthedocs.io/en/latest/
To install this module you need at least powershell v3, was created with 5.1 and intended to be cross platform compatible with powershell v6
To Install this module follow these steps
* Easiest method: Install from PSGallery https://www.powershellgallery.com/packages/FogApi Install-Module -name fogApi
* Manual Method:
* download the zip of this repo and extract it and use Import-Module on the extracted path
The module is now installed.
You can use Set-fogserverSettings to set your fogserver hostname and api keys.
The first time you try to run a command the settings.json file will automatically open
in notepad on windows, nano on linux, or TextEdit on Mac
You can also open the settings.json file and edit it manually before running your first command.
The default settings are explanations of where to find the proper settings since json can''t have comments
Once the settings are set you can have a jolly good time utilzing the fog documentation
found here https://news.fogproject.org/simplified-api-documentation/ that was used to model the parameters
i.e.
Get-FogObject has a type param that validates to object, objectactivetasktype, and search as those are the options given in the documentation.
Each of those types validates (which means autocompletion) to the core types listed in the documentation.
So if you typed in Get-FogObject -Type object -Object h and then started hitting tab, it would loop through the possible core objects you can get from the api that start with ''h'' such as history, host, etc.
Unless you filter a get with a json body it will return all the results into a powershell object. That object is easy to work with to create other commands. Note: Full Pipeline support will come at a later time
i.e.
hosts = Get-FogObject -Type Object -CoreObject Host # calls get on http://fog-server/fog/host to list all hosts
Now you can search all your hosts for the one or ones you''re looking for with powershell
maybe you want to find all the hosts with ''IT'' in the name (note ''?'' is an alias for Where-Object)
ITHosts = hosts.hosts | ? name -match ''IT'';
Now maybe you want to change the image all of these computers use to one named ''IT-Image''
You can edit the object in powershell with a foreach-object (''%'' is an alias for foreach-object)
updatedITHosts = ITHosts | % { _.imagename = ''IT-image''}
Then you need to convert that object to json and pass each object into one api call at a time. Which sounds complicated, but it''s not, it''s as easy as
updateITHosts | % {
jsonData = _ | ConvertTo-Json;
Update-FogObject -Type object -CoreObject host -objectID _.id -jsonData jsonData;
#successful result of updated objects properties
#or any error messages will output to screen for each object
}
This is just one small example of the limitless things you can do with the api and powershell objects.
see also the fogforum thread for the module https://forums.fogproject.org/topic/12026/powershell-api-module/2
Minimum PowerShell version
3.0
Installation Options
Owners
Copyright
2018-2024
Package Details
Author(s)
- JJ Fullmer
Tags
fog fogapi imaging provisioning fogproject
Functions
Add-FogHostMac Add-FogResultData Approve-FogPendingMac Deny-FogPendingMac Disable-FogApiHTTPS Dismount-WinEfi Enable-FogApiHTTPS Find-FogObject Get-FogActiveTasks Get-FogGroupAssociations Get-FogGroupByName Get-FogGroups Get-FogHost Get-FogHostAssociatedSnapins Get-FogHostGroup Get-FogHostMacs Get-FogHostPendingMacs Get-FogHosts Get-FogImages Get-FogInventory Get-FogLog Get-FogMacAddresses Get-FogModules Get-FogObject Get-FogSecsSinceEpoch Get-FogServerSettings Get-FogServerSettingsFile Get-FogSetting Get-FogSettings Get-FogSnapinAssociations Get-FogSnapins Get-FogVersion Get-LastImageTime Get-WinBcdPxeID Get-WinEfiMountLetter Install-FogService Invoke-FogApi Mount-WinEfi New-FogHost New-FogObject Receive-FogImage Remove-FogObject Remove-UsbMac Repair-FogSnapinAssociations Reset-HostEncryption Resolve-HostID Send-FogImage Send-FogWolTask Set-FogInventory Set-FogServerSettings Set-FogServerSettingsFileSecurity Set-FogSetting Set-FogSnapins Set-WinToBootToPxe Start-FogSnapin Start-FogSnapins Test-FogVerAbove1dot6 Update-FogObject
Dependencies
This module has no dependencies.
Release Notes
# 2408.9.2
Release Commit of Major Changes (some changes in other commits)
- Handled Auto add aliases on build #9 so added aliases are available to users.
- Implemented Add foghost name tab completion #8
- Added github actions for testing build and releasing versions
- Fixed issue with getting fog inventory in 1.6
- Implemented #16 for getting and setting fog global settings in fog 1.6
- Implemented #14 for getting the fog version
- Implemented #13 for invoking wol task for a host
- Added basic pipeline functionality for foghost objects in all applicable functions.
- Made it possible to send multiple specified snapins in a single start-fogsnapin call
- Added tab completion of server specific host names and snapin names in various functions like get-foghost, start-fogsnapin. set-fogsnapins, remove-usbmac
- removed advanced function begin/end blocks where they weren't being used as such, kept things in process block
- implemented Add https option to fog server settings #15 by making it so you can put http://fogserver or https://fogserver or fogserver as the fogserver property in settings to implement that change with minimal issues with existing setting configs. Added an enable-FogApiHTTPS funcction as well as a disable to easily enable that.
- Implemented Add function for attempting to set windows machine to boot to pxe from within windows #17
FileList
- FogApi.nuspec
- FogApi.psm1
- en-us\FogApi-help.xml
- lib\settings.json
- FogApi.psd1
- en-us\about_FogApi.help.txt
Version History
Version | Downloads | Last updated |
---|---|---|
2411.9.17 | 1,098 | 11/17/2024 |
2409.9.16 | 5,036 | 9/14/2024 |
2409.9.4 | 852 | 9/4/2024 |
2408.9.3 | 566 | 8/30/2024 |
2408.9.2 (current version) | 575 | 8/22/2024 |
2311.6.4 | 17,243 | 11/17/2023 |
2310.6.3 | 563 | 10/11/2023 |
2310.6.2 | 13 | 10/11/2023 |
2304.5.41 | 3,934 | 4/12/2023 |
2302.5.40 | 10 | 4/12/2023 |
2302.5.33 | 330 | 3/29/2023 |
2302.5.26 | 46 | 3/1/2023 |
2209.4.5 | 222 | 10/21/2022 |
2209.4.1 | 350 | 10/12/2022 |
2208.3.3 | 593 | 8/24/2022 |
2208.3.1 | 20 | 8/23/2022 |
2103.2.13 | 18 | 8/23/2022 |
2103.2.12 | 1,926 | 3/26/2021 |
2004.2.2.7 | 74 | 12/3/2020 |
2004.2.2.4 | 27 | 11/17/2020 |
2002.2.1.2 | 80 | 4/21/2020 |
1903.0.0.22 | 96 | 9/25/2019 |
1.6 | 285 | 6/11/2018 |
1.2 | 31 | 6/5/2018 |