为什么Get-ItemProperty不区分大小写,但Set-ItemProperty区分大小写?

LeB*_*ste 8 iis powershell

我试图IIS为我的DefaultAppPool通道设置属性,PowerShell最后我得到了一个非常好奇的案例:

  • Get-ItemProperty不区分大小写.
  • Set-ItemProperty区分大小写.

有人知道我们为什么会有这种奇怪的行为吗?

PS C:\Windows\system32> Import-Module WebAdministration    
PS C:\Windows\system32> Get-ItemProperty -Path "IIS:\AppPools\DefaultAppPool" -Name Recycling.periodicRestart.privateMemory

...
Value                       : 27

PS C:\Windows\system32> Set-ItemProperty -Path "IIS:\AppPools\DefaultAppPool" -Name Recycling.periodicRestart.privateMemory -Value 10

PS C:\Windows\system32> Get-ItemProperty -Path "IIS:\AppPools\DefaultAppPool" -Name Recycling.periodicRestart.PrIVATeMemory

...
Value                       : 10

PS C:\Windows\system32> Set-ItemProperty -Path "IIS:\AppPools\DefaultAppPool" -Name Recycling.periodicRestart.PRIvateMemory -Value 15

PS C:\Windows\system32> Get-ItemProperty -Path "IIS:\AppPools\DefaultAppPool" -Name Recycling.periodicRestart.PrivateMemory

...
Value                       : 10 #should be 15 if case insensitive...
Run Code Online (Sandbox Code Playgroud)

小智 -5

POSH 中的“Get”语句用于数据收集和对象构建/逻辑编排。换句话说,“Get”X 命令永远不会更改具有区分大小写的服务的配置文件(所有的管理单元都在那里,谁知道哪个服务具有 POSH 抽象)。“Set”命令几乎全部用于更改系统或它们所运行的系统的配置(或使用 WMI/WinRM 进行远程)。