Skip to content

Commit 378b46e

Browse files
authored
Underscore should not be escaped
When trying to run the following with the underscore in `{Get-ItemProperty $\_.PSPath}`: ``` $TimeZone = Get-ChildItem "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Time zones" | foreach {Get-ItemProperty $\_.PSPath}; $TimeZone | sort Display | Format-Table -Auto PSChildname,Display ``` A user gets the following error: ``` Get-ItemProperty : Cannot find path 'C:\Users\thomas.pike.admin\$\_.PSPath' because it does not exist. At line:1 char:102 + ... entVersion\Time zones" | foreach {Get-ItemProperty $\_.PSPath}; $Time ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (C:\Users\thomas.pike.admin\$\_.PSPath:String) [Get-ItemProperty], ItemN otFoundException + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetItemPropertyCommand ``` The correct code is (without the escaped underscore): ``` $TimeZone = Get-ChildItem "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Time zones" | foreach {Get-ItemProperty $_.PSPath}; $TimeZone | sort Display | Format-Table -Auto PSChildname,Display ```
1 parent 93a851c commit 378b46e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exchange/exchange-ps/exchange/client-access/Set-MailboxRegionalConfiguration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ The TimeZone parameter specifies the time zone for the mailbox.
234234
235235
A valid value for this parameter is a supported time zone key name (for example, "Pacific Standard Time").
236236
237-
To see the available values, run the following command: `$TimeZone = Get-ChildItem "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Time zones" | foreach {Get-ItemProperty $\_.PSPath}; $TimeZone | sort Display | Format-Table -Auto PSChildname,Display`.
237+
To see the available values, run the following command: `$TimeZone = Get-ChildItem "HKLM:\Software\Microsoft\Windows NT\CurrentVersion\Time zones" | foreach {Get-ItemProperty $_.PSPath}; $TimeZone | sort Display | Format-Table -Auto PSChildname,Display`.
238238

239239
If the value contains spaces, enclose the value in quotation marks ("). The default value is the time zone setting of the Exchange server.
240240

0 commit comments

Comments
 (0)