Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
perform common tasks on a fresh server
# Common Windows Server Setup (code downloaded from another Gist)
Invoke-Expression ((Invoke-WebRequest "https://gist.githubusercontent.com/dansmith65/010e9ae85a09ce9855206b7558a67b37/raw/WindowsServerSetup.ps1").Content)
# Open FileMaker-specific ports
# NOTE: you might want to add 80 and 443 to the list of ports below, but I haven't needed to in my testing on AWS yet
New-NetFirewallRule -DisplayName "FileMaker Server" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 5003,16000
# Install FileMaker Server: CONFIG
$assistedInstallContents = @"
[Assisted Install]
License Accepted=1
Organization=TODO
Deployment Options=0
FileMaker Server User=0
Admin Console User=TODO
Admin Console Password=TODO
Admin Console PIN=TODO
Launch Deployment Assistant=1
License Certificate Path=
Skip Dialogs=1
"@
$dlUrl = '' # hint: use the installer link from your software download page
# Install FileMaker Server
if ($dlUrl -and -not($assistedInstallContents.Contains("TODO"))) {
$interactive = [Environment]::UserInteractive -and (-not ([Environment]::GetCommandLineArgs() | ?{ $_ -like '-NonI*' }))
$installerPath = Join-Path $env:TEMP (Split-Path $dlUrl -Leaf)
Write-Output "Downloading..."
(New-Object Net.WebClient).DownloadFile($dlUrl, $installerPath)
# extract downloaded file
Set-Location (Join-Path $env:userprofile "Downloads")
$7z = ((Get-Command 7z.exe -EA SilentlyContinue).Path)
if (! $7z) { $7z = "$env:ProgramFiles\7-zip\7z.exe" }
if (! (Test-Path $7z)) { $7z = "${env:ProgramFiles(x86)}\7-zip\7z.exe" }
if (Test-Path $7z) {
.$7z x $installerPath -o"""$(Join-Path $env:userprofile 'Downloads')"""
} elseif ($interactive) {
Write-Output "Cancel installation once extraction is complete"
Start-Process -FilePath $installerPath -Wait
} else {
Write-Output "ABORTED: 7zip command line tool is required to install FMS from a non-interactive shell"
}
# export config files
$installerRootDir = (Get-ChildItem "FileMaker Server*" | Sort-Object -Descending CreationTime)[0].FullName
$setupPath = (Join-Path $installerRootDir "\Files\Setup.exe")
$assistedInstallContents | Out-File (Join-Path (Split-Path $setupPath -Parent) "Assisted Install.txt") -Encoding unicode
# run installer
Start-Process -FilePath $setupPath -ArgumentList $(if($interactive){"/s /v/qb+"}else{"/s /v/qn"}) -Wait
} else {
Write-Output "you must configure before you run this code"
}
@dansmith65

This comment has been minimized.

Copy link
Owner Author

dansmith65 commented Nov 14, 2019

NOTE: This script MUST be modified before using; refer to the Install FileMaker Server: CONFIG section

Can be run on a new AWS EC2 instance by wrapping it in <powershell></powershell>. Refer to this link for more info: https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/ec2-windows-user-data.html

Other Gist's referenced by this one:

@dansmith65

This comment has been minimized.

Copy link
Owner Author

dansmith65 commented Nov 26, 2019

Can install FMS with your own license by adding:

$licenseCertContents = @" 
TODO: replace this line with your certificate file contents
"@
# add this line right before Start-Process:
[System.IO.File]::WriteAllLines((Join-Path (Split-Path $setupPath -Parent) "LicenseCert.fmcert"), $licenseCertContents) # don't use Out-File because it creates utf8 with BOM
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.