diff --git a/IISU/IISManager.cs b/IISU/IISManager.cs index 39de8a8..9d56989 100644 --- a/IISU/IISManager.cs +++ b/IISU/IISManager.cs @@ -64,7 +64,7 @@ public IISManager(ReenrollmentJobConfiguration config,string serverUserName,stri { SiteName = config.JobProperties["SiteName"].ToString(); Port = config.JobProperties["Port"].ToString(); - HostName = config.JobProperties["HostName"].ToString(); + HostName = config.JobProperties["HostName"]?.ToString(); Protocol = config.JobProperties["Protocol"].ToString(); SniFlag = config.JobProperties["SniFlag"].ToString()?.Substring(0, 1); IpAddress = config.JobProperties["IPAddress"].ToString(); diff --git a/IISU/Jobs/ReEnrollment.cs b/IISU/Jobs/ReEnrollment.cs index 5c2c337..edb7036 100644 --- a/IISU/Jobs/ReEnrollment.cs +++ b/IISU/Jobs/ReEnrollment.cs @@ -118,12 +118,15 @@ private JobResult PerformReEnrollment(ReenrollmentJobConfiguration config, Submi ps.AddScript($"Add-Content $infFilename 'KeyLength={keySize}'"); ps.AddScript($"Add-Content $infFilename 'KeySpec = 0'"); - ps.AddScript($"Add-Content $infFilename '[Extensions]'"); - ps.AddScript(@"Add-Content $infFilename '2.5.29.17 = ""{text}""'"); - - foreach (string s in SAN.ToString().Split("&")) + if(SAN != null) { - ps.AddScript($"Add-Content $infFilename '_continue_ = \"{s + "&"}\"'"); + ps.AddScript($"Add-Content $infFilename '[Extensions]'"); + ps.AddScript(@"Add-Content $infFilename '2.5.29.17 = ""{text}""'"); + + foreach (string s in SAN.ToString().Split("&")) + { + ps.AddScript($"Add-Content $infFilename '_continue_ = \"{s + "&"}\"'"); + } } // Execute the -new command