FogApi

2002.2.1.2

This module is used to easily run Fog API commands on your fogserver from a powershell console or script.
   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 module is used to easily run Fog API commands on your fogserver from a powershell console or script.
   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
   
Show more

Minimum PowerShell version

3.0

Installation Options

Copy and Paste the following command to install this package using PowerShellGet More Info

Install-Module -Name FogApi -RequiredVersion 2002.2.1.2

Copy and Paste the following command to install this package using Microsoft.PowerShell.PSResourceGet More Info

Install-PSResource -Name FogApi -Version 2002.2.1.2

You can deploy this package directly to Azure Automation. Note that deploying packages with dependencies will deploy all the dependencies to Azure Automation. Learn More

Manually download the .nupkg file to your system's default download location. Note that the file won't be unpacked, and won't include any dependencies. Learn More

Owners

Copyright

(c) 2018 JJ Fullmer. All rights reserved.

Package Details

Author(s)

  • JJ Fullmer

Tags

fog fogapi imaging provisioning fogproject

Functions

Add-FogHostMac Approve-FogPendingMac Deny-FogPendingMac Get-FogActiveTasks Get-FogAssociatedSnapins Get-FogGroup Get-FogHost Get-FogHosts Get-FogInventory Get-FogLog Get-FogObject Get-FogServerSettings Get-FogSnapins Get-PendingMacsForHost Install-FogService Invoke-FogApi New-FogObject Remove-FogObject Remove-UsbMac Reset-HostEncryption Set-FogInventory Set-FogServerSettings Set-FogSnapins Start-FogSnapins Update-FogObject

Dependencies

This module has no dependencies.

Release Notes


# 2002.2.1.2

Description in manifest was too long

# 2002.2.1.1

Updated documentation on most functions, all have at least some basic info. Also linked all documentation to https://fogapi.readthedocs.io/en/latest/ for online versions

# 2002.2.0.8

general updates and bug fixes

# 2002.2.0.7

Test build

# 2002.2.0.6

Test build

# 2002.2.0.5

   Test build

# 2002.2.0.4
   
   Test build

# 1904.0.0.1
       
   CF-249 #comment fixed add-fogmac property within the function and incrementing the version to match release time

# 1903.0.0.23

   Added functions for reseting host encryption as well as adding, approving, and removing macs from hosts

# 1903.0.0.22

   Move from dev to production

# 1903.0.0.21

   update documentation

# 1903.0.0.20

   dont addition on random variable create a list

# 1903.0.0.19

   update get settings with same new paths silly

# 1903.0.0.18

   force the copy

# 1903.0.0.17

   change where settings file is stored to an appdata folder of the current user

# 1903.0.0.16

   CF-214 #comment updated remove-usbmac to utilize internal functions better and made it more universal, may want to later update it to remove all matching associations of the list, but would also need a function for getting the mac list of the host it is connected to when it is the primary which sounds cumbersome at the moment

# 1903.0.0.15

   Updated documentation for each function and moved the dynamic param functions to be private functions as they dont need to be visible in the user interface

# 1903.0.0.14

   CF-223 #comment use internal commands more

# 1903.0.0.13

   CF-223 #comment use internal commands more

# 1903.0.0.12

   dont try to add snapins that are already there

# 1903.0.0.11

   CF-223 #comment updated set-fogsnapins to use internal new-fogobject function and had it only attempt to set snapins that actually exist

# 1903.0.0.10

   CF-223 #comment updated set-fogsnapins to use internal new-fogobject function and had it only attempt to set snapins that actually exist

# 1903.0.0.9

   CF-223 #comment made setting list of fogsnapins more universal and not reference object it doesnt need to

# 1903.0.0.8

   CF-223 #comment made setting list of fogsnapins more universal and not reference object it doesnt need to

# 1903.0.0.7

   CF-223 #comment fix uuid get in getfoghost

# 1903.0.0.6

   CF-223 #comment fix uuid get and set for when uuid isnt correct in first spot

# 1903.0.0.5

   CF-129 #comment updated fogapi syntax issues fixes

# 1903.0.0.4

   CF-206 #comment quick syntax updates on fogapi dev module

# 1903.0.0.3

   CF-205 #comment updated fogapi dev module with functions for snapins

# 1903.0.0.2

   CF-204 #comment updated various functions to utilize new structure

# 1903.0.0.1

   CF-204 #comment updated fogapi module to new module structure

# 1902.0.0.3

   CF-218 #comment default invoke-api to use GET method

# 1902.0.0.2

   CF-218 #comment need to have published the dev fogapi module without dev prefix

# 1902.0.0.1

   CF-124 #comment added get-foglog function for easier opening of a dynamic fog log when debugging provisioning and imaging issues

# 1.8.1.6

   testing fix for update error looks like the wrong dynamic parameter was being referenced where the uri was being built

# 1.8.1.5

   CF-120 #comment adding fogapi dev module to repo

# 1.8.1.4

   fix possible exit

# 1.8.1.3

   use spacebar and use ea 0 on get-service check for install-fogservice

# 1.8.1.2

   finish end block on install-fogservice

# 1.8.1.1

   updated install-fogservice to try using the smart installer if the msi doesn work

# 1.8.0.5

   fixes to settings setter and remove double slashes

# 1.8.0.4

   fixes to settings setter and remove double slashes

# 1.8.0.3

   fixes to settings setter

# 1.8.0.2

   fixes to settings setter

# 1.8.0.1

   updated settings setter and getter to store settings json in fog service folder

# 1.7.1.1

   try catch block to attempt iwr when irm fails

# 1.7.0.5

   update update function to allow specifying uri path manually

# 1.7.0.4

   update update function to allow specifying uri path manually

# 1.7
   
   Fixed parantheses typo in get-fogobject and signing issue

# 1.5
   
   Added dynamic parameters and added get-fogserversettings and set-fogserversettings to allow for setting the api keys and server name in the shell
   One known issue with the dynamic parameters is that they currently are not working as expected with positions they have to be named. i.e. you have to say get-fogobject -type object -coreObject host not Get-FogObject object host like I wanted
   The auto complete works for positional parameters but the function doesn''t seem to think there''s a vaule for the parameter.

# 1.3

   added better description and links, fixed new-fogobject to not require id for all POST api calls as there is no id yet for new items.

# 1.2
   
   Initial Release, allow for easy manipulation of FOG server data with powershell objects

FileList

Version History

Version Downloads Last updated
2411.9.17 1,291 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 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 (current version) 80 4/21/2020
1903.0.0.22 96 9/25/2019
1.6 285 6/11/2018
1.2 31 6/5/2018
Show less