I am trying to put together a quick little script to help when I am using OpenSSL, for some reason I can't seem to get PowerShell to append the hostname to the front of my CSR file. It is basically giving me things like _09_26_2017.txt instead of something like hostname_09_26_2017.txt.
I have the following
$date = Get-Date -format MM_dd_yyyy
$csrName = $siteName + "_" + $date
$siteName = Read-Host "Enter the site name"
.\openssl.exe req -newkey rsa:4096 -sha256 -nodes -keyout "$siteName.pem" -out "$csrName.txt"
Any help would be greatly appreciated. Thank you very much in advance.