__________________________________________________ _______________________________
Burada RUNTİME yani çalışma hatası olduğun da EXCEPTİON yani İSTİSNA fırlatmasın diye dönen çıktıyı OUTPUT şeklinde bir dizi değişkene atıyoruz .
Burası bizim dosya yolumuzu yani FİLE PATH ifade ediyor .
if($processerror.Count -ne 0 -or $processwarning.Count -ne 0 -or $processinformation.Count -or 0 -or $script_path.Length -le 0) {
exit;
}
__________________________________________________ __________________________________________________ _________________________________________________
Bir hata olur ise şayet olması imkansız ama bir hata olduğu an bu işlemde hemen betiği sonlandırıyoruz .
$script_path=$script_path -replace '', '/' -replace 's+', ' ';
__________________________________________________ _______________________________
Burada REGEX yani Düzenli ifade ile DOSYA yolunu yani FİLE PATH bunu REPLACE ediyoruz ve dosya yollarını WİNDOWS FİLE PATH standardına uygun hale getiriyoruz .
function apply-cert {
Param ([String]$exe,[String]$config,[String]$key,[String]$cert)
if([System.IO.File]::Exists($script_path/ $exe) -ne $true -or [System.IO.File]::Exists($script_path/ $config) -ne $true) {
return $false;
}
$respond=cmd.exe /c "$script_path/ $exe req -config $script_path/ $config -new -sha256 -newkey rsa:2048 -nodes -keyout $script_path/ $key -x509 -days 3650 -out $script_path/ $cert" 2>$null;
if([System.IO.File]::Exists($cert) -ne $true -or [System.IO.File]::Exists($key) -ne $true) {
return $false;
}
$cert=Get-ChildItem -Path Cert:LocalMachineRoot | Where-Object { $_.Subject -match 'SSLCONFİGNAME' } | Remove-Item;
Import-Certificate -FilePath "$script_path/$cert" -CertStoreLocation Cert:LocalMachineRoot;
return $true;
return $false;
}
__________________________________________________ ____
Burada ise bir fonksiyon oluşturup kullanılabilir hale getiriyoruz .
aply-cert -exe "exe adres" -config "konfig adres" -key "key adres" -cert "CERT adres"
bu şekilde kullanarak SSL SERTİFAMIZI otomatik oluşturup SERTİFİKA olarak dahil ediyoruz .
Görüldüğü üzere POWERSHELL bu kadar geniş ve ucu bucağı yok .
WİNDOWS SERVER ile alakalı bütün işlemlerinizde gönül rahatlığıyla kullanabilirsiniz .
___________
Dediğiniz gibi aslında SEO ve WORDPRESS vesaire o konularda açsam daha iyi Kimsenin POWERSHELL ile alakalı bir şey öğrenmeye niyeti yok
@CGLR;