Hi, You can add a Param block to your script and append Out-File to each Get-WebConfigurationProperty cmdlet, then you can run the script with the WebsiteName parameter.
Param(
[Parameter(Mandatory=$true)]
$WebsiteName
)
$log = "C:\Temp\log.txt"
Get-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST/$WebsiteName" -filter 'system.web/authentication/forms' -name 'requireSSL' | Out-File -FilePath $log -Append
Get-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST/$WebsiteName" -filter 'system.web/authentication/forms' -name 'cookieless' | Out-File -FilePath $log -Append
Get-WebConfigurationProperty -pspath "MACHINE/WEBROOT/APPHOST/$WebsiteName" -filter 'system.web/authentication/forms' -name 'protection' | Out-File -FilePath $log -Append
Get-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST' -location '' -filter 'system.webServer/security/access' -name 'sslFlags' | Out-File -FilePath $log -Append
Get-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/' -filter 'system.web/authentication/forms/credentials' -name 'passwordFormat' | Out-File -FilePath $log -Append
Best Regards,
Ian Xue
If the Answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.