Need some advice / direction
-
Hi Guys,
I have been using Fog now for about 2 months, still learning every day
I wanted to ask I have a master node with remote storage nodes, I am using the my fog setup for people to bring in old machines to be re-imaged remotely. The idea is the end user plugs in his computer PXE boots, then his license key and current OS information along with his computer specs is extracted after inputting, the following: their name and generated code and this will set-off a process which install the correct OS that the have installed with their license key activated.
So my question is this, Is this possible to do ? Is it possible to run a powershell script at the PXE menu level ? How can i remotely deploy an image to there machine? Without registration onto the system?
Currently I have a WinPE environment that they boot into and from there I remote in and run the install from there. Is there a way to remotely force a machine into a PXE boot selecting a certain image ?
Kind regards
-
@zaboxmaster said in Need some advice / direction:
You are a bit all over the place with this question (not intended to sound harsh) Donât read more into what Iâm going to say because some parts will sound negative only to point out some parts of your idea that need to be worked on. So lets breakdown what you have asked.
I wanted to ask I have a master node with remote storage nodes, I am using the my fog setup for people to bring in old machines to be re-imaged remotely.
So far not a problem
The idea is the end user plugs in his computer PXE boots, then his license key and current OS information along with his computer specs is extracted after inputting, the following: their name and generated code and this will set-off a process which install the correct OS that the have installed with their license key activated.
This is where things get a bit cloudy. FOG doesnât care about licenses, or windows for that matter. Since you are talking about extracting windows licenses, can we assume you are using OEM licenses for activation? If so the MS EULA doesnât allow you to deploy OEM licensed media via imaging. You must install systems that use OEM licenses directly from the OEM media to remain compliant with the EULA. If you are using VL licenses then there are ways to utilize and activate these keys with FOG.
So my question is this, Is this possible to do ? Is it possible to run a powershell script at the PXE menu level ?
The FOS Linux engine runs on a customized linux OS. This FOS engine doesnât know or care about the target OS. The FOS engine canât do windows specific things like running windows programs, scripts, or adjust the registry. You CAN run bash shell scripts on the FOS engine which is customizable in a FOG Postdownload script (will be important later).
How can i remotely deploy an image to there machine? Without registration onto the system?
Yes and no. You can deploy a system at a remote location from that systemâs iPXE menu without registering the system. But it will require a person physically in front of the computer. The issue you will have is that if the system isnât registered it wonât know which storage node is closest so it will always go back to the master node.
Is there a way to remotely force a machine into a PXE boot selecting a certain image ?
You canât force a remote machine to pxe boot unless its a Dell (AFAIK). If you have a computer registered in FOG, AND have a FOG client installed on the remote system, AND you have the remote machine configured to boot through the iPXE menu every time you can remotely deploy an image to that computer without end user interaction.
So now with that said, what could you do if you donât want to register target computers with FOG.
You could use the FOG iPXE menu to deploy image. When you go into that menu item it lists all images released on the master FOG server. Users can deploy an image from there and the system will deploy. You canât ask questions easily from the user before the image is deployed. BUT you could add a FOG Postdownload script that can ask users questions in a bash shell script. When the postdownload script is executed, the image has already been pushed to the target computer, but before the target computer first boots into the target OS (in this case before WinSetup/OOBE is first run). You can from FOS Linux leave breadcrumbs on the Windows drive that can be picked up and used during WinSetup/OOBE. These breadcrumbs could be updating the unattend.xml file with license keys, settings like location and keyboard, etc. You can see examples of this in this tutorial: https://forums.fogproject.org/topic/7740/the-magical-mystical-fog-post-download-script Use this as a reference to what can be done, there is another tutorial that is more up to date but not as detailed as what Iâve linked.
Your idea is possible with a little work, you just need to move out of the windows paradigm a think a bit more in the linux world to pull it off. Just understand you are using FOG in a way it which it wasnât originally designed. But that is the beauty of an opensource system.
-
@george1421 Thank you so much for this. I will dig further into this.
I wanted to ask is there a way to edit the host registration process ? As in when you register the host to run the following line of code : sudo cat /sys/firmware/acpi/tables/MSDM to get the license key and send this along with the machine specs to an email address ?
-
@zaboxmaster The short answer is with a little effort you can do this.
What it requires is someone with a little bash and php coding experience. There are perfect examples on the internet how to do this.
You will need to patch the fog.man.reg script inside FOS Linux. The
fog.man.reg
file is listed here: https://github.com/FOGProject/fos/blob/master/Buildroot/board/FOG/FOS/rootfs_overlay/bin/fog.man.regWhat you need to do is insert a curl call at the right spot to send the information to the FOG server to send out the email.
I need to test this curl call to ensure the right information is sent. For now its just the concept
curl -X POST --data "host=$host" ${web}/fogmailer.php
Here is an example of how I setup a php page to send an email. It takes fields sent in a html form. You would save this in the root of your fog path named
fogmailer.php
or whatever.<?php if(isset($_POST['mail_sendto'])) { function died($error) { echo "We are very sorry, but there were error(s) found with the form you submitted. "; echo "These errors appear below.<br /><br />"; echo $error."<br /><br />"; echo "Please go back and fix these errors.<br /><br />"; die(); } // validation expected data exists if(!isset($_POST['mail_sendfrom']) || !isset($_POST['mail_subject']) { died('We are sorry, but there appears to be a problem with the form you submitted.'); } $email_sendto = $_POST['mail_sendto']; $email_ccto = $_POST['mail_ccto']; $email_bccto = $_POST['mail_bccto']; $email_from = $_POST['mail_sendfrom']; $email_subject = $_POST['mail_subject']; $email_body = $_POST['mail_body']; $error_message = ""; function clean_string($string) { $bad = array("content-type","bcc:","to:","cc:","href"); return str_replace($bad,"",$string); } // create email headers $headers = 'From: ' . $email_from . " \r\n" . // 'To: ' . $email_sendto . " \r\n" . 'Cc: ' . $email_ccto . "\r\n" . 'Bcc: ' . $email_bccto . "\r\n" . 'Reply-To: noreply@domain.com' . "\r\n" . 'X-Mailer: PHP/' . phpversion(); @mail($email_sendto, $email_subject, $email_body, $headers); } ?>
-
@george1421 Hi George
I have tried the above mentioned method, but I am still stuck.
I have changed the fog.man.reg also to ask a couple of questions and deleted questions I did not need. I have assigned two questions to the variables other1 and other2.
When I send the information to my own PHP page in the root directory the information is blank.
When I try view the variables by editing the fog.inventory file is also displays as blank.My PHP page does send the information via email, the problem is that it is blank or comes across âencrypted?â .
I know the question seems very vague.
-
@zaboxmaster can you post the modified registration file here or via a share file site? Without knowing the changes its hard to know what is going wrong.
Note if you post it here, you may need to tack on a .txt extension so it can be uploaded.
-
Okay so I have tried 2 methods. One sending from the fog.man.reg and the other sending from fog.inventory.
At this point I am trying everything. I am only sending a couple variables as a test , once it works i will send as many as possible.
My fog.man.reg
fog.man.reg.txtMy fogmailer.php
fogmailer.txtMy fog.inventory
fog.inventory.txt -
@zaboxmaster ok let me take a look.
-
@zaboxmaster Lets switch over to IM chat because there are a few questions I have. Look at the chat bubble and the top-right of the forum tool bar