Drafting:
Added powershell functionality to the boot.wim (130mb extra this could be a
problem).
this is a first draft.
I need actually to add curl (gnu so no problem here).
## START
# warning: this script has been written by a complete moron.
## Disable the firewall
Wpeutil disablefirewall > $null
## Set the path of curl (GPL distribuited)
$curl="x:\windows\system32\curl.exe"
## Get the MAC
$mac=$(Get-WmiObject win32_networkadapterconfiguration -Filter ipenabled=
"true"|select -expandproperty macaddress|select-object -first 1).Tolower()
## Optain the DHCP server (that is also the TFTP server)
$foremanproxy=$(Get-WmiObject Win32_NetworkAdapterConfiguration | ? {$_.
DHCPEnabled -eq $true -and $_.DHCPServer -ne $null} | select -expandproperty
DHCPServer|select-object -first 1)
## Change the mac to the format witht the dash instead of semicolons
$mac=$mac -replace ":", "-"
## Build the path to the pxelinux configuration
$tftp='tftp://' + $foremanproxy + '/pxelinux.cfg/01-' + $mac
## Build the commandline to retrive the TFTP
$command=$curl + ' ' + $tftp + ' -o pxeconf.tmp'
## Obtain the pxe configuration
iex $command
## Extract variables
# Getting URL
$URL=$(cat .\pxeconf.tmp|findstr.exe URL) -replace '.# URL=','' -replace ' '
,''
## Place it in an environment
## Retrive the TOKEN
## Get the unattended script
$command=$curl + ' ' + $URL + ' -o unattended.xml'
iex $command
## END
Would be cool to reduce this script to a Batch so I won't need to add
PowerShell.
Thoughts? Impressions?
K.
Il giorno martedì 25 ottobre 2016 10:50:34 UTC+2, Andrea Cervesato ha
scritto:
>
> As far as I know there is no way to pass variables/environments
> informations directly to wondows (WinPE) without (re)building the image and
> including the configuration in it.
>
> I've found that a simple way could help us without too many hacks.
>
> Actually when we boot up we spawn an IP from the DHCP from our TFTP/Proxy
> server.
>
> The pxe configuration at the moment show something like this:
> DEFAULT menu
> LABEL menu
> COM32 linux.c32 boot/wimboot
> APPEND initrdfile=boot/windows-x64/bcd,boot/windows-x64/boot.sdi,boot
> /windows-x64/boot.wim
>
>
> Adding at the end of the PXE the variables in a commented way could be a
> good alternative:
> DEFAULT menu
> LABEL menu
> COM32 linux.c32 boot/wimboot
> APPEND initrdfile=boot/windows-x64/bcd,boot/windows-x64/boot.sdi,boot
> /windows-x64/boot.wim
>
> #VAR FOREMANURL "https://myforeman.url.domain.ext"
> #VAR AUTOPROVISION "https://myforeman.url.domain.ext
> /unattended/provision?token=0000000-0000-0000-0000-0000000000"
> #VAR HOSTNAME "MYHATEDWINMACHINE01"
> #VAR DOMAIN "windowsdomain01.local"
>
>
>
> After that with a script that will be the same per any installation we
> will contiune the installation.
> We'll need a TFTP client (obviously) and a good dose of batch scripting.
>
> I'm not that good on windows and I can use an hand.
>
> With this configuration we will be able to installa machine behind NAT
> that actually could not get the provision configration file.
>
> K.
>
--
You received this message because you are subscribed to the Google Groups
"foreman-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.