I'm new to powershell and am creating a script that will create a sharepoint site using user input. One of the variables is a Template. I want the script to say if there's no user input then the $Template variable will be a default value of "Team Site" otherwise if there is user input then use that.
I know my issue is with the "$Template = $TemplateInput" line but I don't know what to put here to grab the user input instead of just repeating the question. Maybe I'm overthinking this but I'm pretty sure this is just a loop.
Here's my code:
$TemplateInput = Read-Host -Prompt "What sharepoint template should be used? Leave blank for default; Team Site"
if ($TemplateInput -eq $null) {
$Template = "Team Site"
Write-Host "Using Template: Team site"
}
else {
$Template = $TemplateInput
}
PAUSE