Greetings everyone...
So I'm writing a script that involves capturing the IIS Logs Directory. To find the directory of the where IIS logs are located at, I do the following: $IISLogDirectory = Get-WebConfigurationProperty "/system.applicationHost/sites/siteDefaults" -name logfile.directory.value
I get the following output:
%SystemDrive%\inetpub\IISLogFiles
This is correct and is exactly what I'm looking for. The only problem is Powershell doesn't know how to interpret the %systemdrive% environment valuable due to the percent signs. When I do Get-ChildItem -path $IISLogDirectory, I get an error because of the percent signs in the string.
I suppose I can add a command to strip the percent signs, but I was wondering if there was some sort of syntax I could use so that powershell interprets the percent signs correctly. How do you folks handle percent signs in environment variables?
So I'm writing a script that involves capturing the IIS Logs Directory. To find the directory of the where IIS logs are located at, I do the following: $IISLogDirectory = Get-WebConfigurationProperty "/system.applicationHost/sites/siteDefaults" -name logfile.directory.value
I get the following output:
%SystemDrive%\inetpub\IISLogFiles
This is correct and is exactly what I'm looking for. The only problem is Powershell doesn't know how to interpret the %systemdrive% environment valuable due to the percent signs. When I do Get-ChildItem -path $IISLogDirectory, I get an error because of the percent signs in the string.
I suppose I can add a command to strip the percent signs, but I was wondering if there was some sort of syntax I could use so that powershell interprets the percent signs correctly. How do you folks handle percent signs in environment variables?