How to use execute FOG through command line?
-
For example, is it possible to restart a machine and have it reimage itself using a command line approach?
I am a qa automator and I want to be able to deploy tests onto a specific machine and then have them automatically reimaged when the tests are done running. I am using Jenkins as a deployment server and as far as I know, there is no FOG plugin for Jenkins so I would need to do this through command line.
-
If you schedule a deploy task and no user is logged in, and you have globally enabled the reboot for scheduled jobs settings, and left it enabled in the client, then within 5 minutes the client should detect it has a job waiting and reboot using whatever boot order you have defined in the bios.
You can also use the command line tool built into windows since Windows XP: shutdown.exe, provided you have permissions on the remote machine.
-
[quote=“chad-bisd, post: 11463, member: 18”]If you schedule a deploy task and no user is logged in, and you have globally enabled the reboot for scheduled jobs settings, and left it enabled in the client, then within 5 minutes the client should detect it has a job waiting and reboot using whatever boot order you have defined in the bios.
You can also use the command line tool built into windows since Windows XP: shutdown.exe, provided you have permissions on the remote machine.[/quote]
Is there a way to deploy a task through command line from the FOG server?
-
This post is deleted! -
not built in, but you can call the php files passing in the correct information, I think.
-
Perhaps just create a snapin with the requirede command inside, then you can just activate that for the host and it will reboot.
-
I too am interested in being able specifically to launch deploy task from a command prompt (even if it’s on the FOG server itself). It’s not ideal to just schedule a task on shutdown because I may need to shut down the machine several times before I re-image. Does any one have any other ideas ?
-
@jape I’m not sure I understand your issue/quest. You can pxe boot while sitting in front of the computer, then in the FOG iPXE menu pick deploy image. This will not register the target computer with FOG, its simply load and go. This process is used by system remanufacturers to/where fog will never see the target computer again once its imaged.
There are a few caveats in using the load and go process in that you can not use the fog client during deployment (because the target computer is never registered with FOG). That also means that snapins will not deploy during image deployment too.
If I’ve missed your intent, please explain your problem a bit more.
-
@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