• 0 Votes
    1 Posts
    471 Views
    No one has replied
  • 0 Votes
    11 Posts
    2k Views
    S

    I changed the code to PHP and now it works, so I think it was something security related from the browser.

  • API PUT request not working

    FOG Problems
    5
    0 Votes
    5 Posts
    1k Views
    B

    @judzk sorry I just saw this and yes I also see the error.

    Glad its working for you now.

    I also didn’t use the powershell module.

  • 0 Votes
    4 Posts
    1k Views
    JJ FullmerJ

    @r-pawlowski I would be happy to help in anyway I can. Personally, I deploy a bootmanager (grub2win) and the ipxe.efi file to each machines efi partition. Then I can just change the boot managers default to boot straight to fog. It takes a bit of time to get setup, but I found it to be the most reliable as I then didn’t have to worry as much about the bios settings. Theoretically you can use bcdedit commands to change the boot order to boot to network, but that also differs on different hardware.

    I digress though, the easy bit for queueing an image to deploy

    Follow the setup instructions for the fog API (involves installing the module from powershell gallery and then inputting your API keys and fog server address) Then make sure the host you’re imaging is assigned the correct image, this can be changed in the API if you need that, but for this quick example, we’ll pretend it’s set correct. For an example, we’ll say the hostname of a computer in fog is ‘test-computer’, so this will find the host in fog, then queue an image to deploy on it right now $hostID = (Get-FogHost -hostname 'Test-Computer').id #create a quick json string, this can also be done in a powershell object and converted, but this is just a quick example. #tasktypeID of 1 is a deploy task, if no runtime/schedule time is specified, it defaults to instant deploy # shutdown = 0 is not scheduling with shutdown # I believe other2 = 0 means not a debug # other4 = 1 means to enable wol # isactive =1 means the task is active $jsonData = "{`"taskTypeID`": 1,`"shutdown`":`"0`",`"other2`":`"0`",`"other4`":`"1`",`"isActive`":`"1`" }"; # make the API call to create the new task for your host New-FogObject -type objecttasktype -coreTaskObject host -jsonData $jsonData -IDofObject $hostId;

    Once you have this all setup in a powershell module or script internally, you can get things automated pretty smoothly. It’s meant to be modular so it can be applied to any infrastructure or workflow and built upon.

    If you need more help let me know and I’ll see what I can do.

  • API questions

    FOG Problems
    1
    0 Votes
    1 Posts
    434 Views
    No one has replied
  • 1 Votes
    6 Posts
    1k Views
    JJ FullmerJ

    @Chris-Whiteley I finally had some time to work on the module and created a Start-FogSnapin function that can deploy a single snapin task.

    See also https://fogapi.readthedocs.io/en/latest/commands/Start-FogSnapin/

  • API FOG : How to Apply PxeMenuOptions to Host

    General
    5
    0 Votes
    5 Posts
    1k Views
    G

    i think i’ve found the solution .

    i just made a new ipxemenu entry with my winpe and force via API , the default parameter to 1 to this menu entry i can find in coreobjects pxemenuoptions.

    i’ll keep you informed

  • 0 Votes
    14 Posts
    3k Views
    D

    Thank you!

  • Authenticate on FOG API

    Solved FOG Problems
    8
    0 Votes
    8 Posts
    2k Views
    9

    @tom-elliott yes, Zm9nOnBhc3N3b3Jk (default fog:password), as you can see on screenshot. I’m also create new user, enable API for him and get same result.

    And same result with curl:

    [root@ ~]# curl -H 'fog-api-token: <token>' -u fog:password -X GET http://<fog-ip>/fog/system/status [root@ ~]# curl -H 'fog-api-token: <token>' -H 'Authorization: Basic Zm9nOnBhc3N3b3Jk' -X GET http://<fog-ip>/fog/system/status [root@ ~]# curl -H 'fog-api-token: <token>' -H 'fog-user-token: <token>' -X GET http://<fog-ip>/fog/system/status **success**

    Only auth with two tokens work fine.

  • FOG API AD JSON Settings

    Unsolved FOG Problems
    6
    0 Votes
    6 Posts
    1k Views
    JJ FullmerJ

    @RobTitian16

    I realize this is a few month’s old. But you might want to check out and or contribute to the fog module I have in git and published in the powershellgallery, there’s a forum post with more info here https://forums.fogproject.org/post/120746
    Also did you have a chance to try the code I posted back in september and see if that worked? Because it works for me.
    And looking again at your code I would ask what the value of $useAD is, is it 1 it should be 1. And I would also try piping the object into convertto-json, I’ve had better luck with that, I think it parses it different i.e. $CreateHostJson = $HostJson | ConvertTo-Json I would also encapsulate everything in quotes on the splat.
    The only other thing that might be an issue is the ADPass. When you get the password via the api it is returned in plain text (because you already authenticated with api keys, so it’s not like just anyone can grab it). When you input the password in the gui you put it in plaintext and it encrypts when you hit save, I don’t think the same thing happens if you set it through the api. My solution has been to always enable the default AD settings when adding a host via the gui or the pxe menu. But it sounds like you’re adding the host through the api. The “useAD”=“1” in the json should be causing the checkbox for the ‘join domain after deploy’ to be checked. Sadly when you check it from the api it doesn’t pull the default domain settings. You might try creating the host without the AD settings and then sending just the AD settings in an update/put command. If you copy paste the already encrypted password from a working host in the gui, that might do the trick as it seems to pass whatever you put in that field to be in plaintext.

    So point is, try adding the domain stuff with an update api command after creating. And use the code I have in the example to help if needed.

  • 4 Votes
    32 Posts
    13k Views
    JJ FullmerJ

    Another Release(s)! 2506.9.22
    https://github.com/darksidemilk/FogApi/releases/tag/2506.9.22

    2506.9.19-22 are a slew of releases where I kept finding issues in broader tests right after I released each version. So apologies for the over-releasing there.

    Fixed send-fogimage to work with more use cases and utilize more parameters available to scheduled tasks like bypassbitlocker. Also simplified the parameter sets to avoid errors when using the command with different parameter sets. Also added links to PSGallery and chocolatey in each github release going forward.

    Full Release Note History: https://fogapi.readthedocs.io/en/latest/ReleaseNotes/
    Powershell Gallery Listing for this version: https://www.powershellgallery.com/packages/FogApi/2506.9.22
    Chocolatey Package Listing for this version (may take 1-60 days from release to be approved by chocolatey moderators): https://community.chocolatey.org/packages/FogApi/2506.9.22

  • 0 Votes
    9 Posts
    6k Views
    JJ FullmerJ

    @jape You can use the api (See the powershell api module links in my signature). You can use it to create the scheduled task. i.e. (provided you got the module all setup prior) the following would create a scheduled deploy task for host with id ‘1234’
    at 8 pm tonight. The following is all powershell that can be run from your admin workstation.

    #define the schedule time in the linux format $startAtTime = (get-date 8pm) $EpochDiff = New-TimeSpan "01 January 1970 00:00:00" $($startAtTime) $scheduleTime = [INT] $EpochDiff.TotalSeconds - [timezone]::CurrentTimeZone.GetUtcOffset($(get-date)).totalseconds #define the schedule time in human readable format $runTime = get-date $StartAtTime -Format "yyyy-M-d HH:MM" $jsonData = @" { "name":"Deploy Task", "type":"S", "taskTypeID":"1", "runTime":"$runTime", "scheduleTime":"$scheduleTime", "isGroupTask":"0", "hostID":"1234", "shutdown":"0", "other2":"0", "other4":"1", "isActive":"1" } "@ #create the scheduled deploy task with the defined json New-FogObject -type object -coreObject scheduledtask -jsonData $jsonData