Answered by:
A parameter cannot be found that matches parameter name 'Type'

Question
-
I am trying to set the registry key using below command , but somehow the type parameter is not accepted . can anyone correct me if there is a parameter mistake . But when I see the regedit the type is Reg_Dword .
Invoke-Command -ComputerName @("ServerName") -ScriptBlock{Set-ItemProperty -Path "HKU:\UserSession\Software\Microsoft\Windows\CurrentVersion\Internet Settings" -Name "ProxyEnable" -Value 1 -Type "DWord"}
I am getting below error :
A parameter cannot be found that matches parameter name 'Type'.
+ CategoryInfo : InvalidArgument: (:) [Set-ItemProperty], ParameterBindingException
+ FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.PowerShell.Commands.SetItemPropertyCommand
+ PSComputerName : ServerName
Best Regards,SQLBoy
- Edited by Kumar GK Tuesday, March 6, 2018 3:36 PM
Tuesday, March 6, 2018 3:34 PM
Answers
-
Set-ItemProperty doesn't have a parameter called type, it may create the type based off of what is supplied in the value. New-ItemProperty has a PropertyType parameter which will do what you want.
PS S:\Scripts\Powershell> get-help set-itemproperty -Parameter * -Confirm Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases cf Dynamic? false -Credential <pscredential> Required? false Position? Named Accept pipeline input? true (ByPropertyName) Parameter set name (All) Aliases None Dynamic? false -Exclude <string[]> Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases None Dynamic? false -Filter <string> Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases None Dynamic? false -Force Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases None Dynamic? false -Include <string[]> Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases None Dynamic? false -InputObject <psobject> Required? true Position? Named Accept pipeline input? true (ByValue, ByPropertyName) Parameter set name propertyPSObjectPathSet, propertyPSObjectLiteralPathSet Aliases None Dynamic? false -LiteralPath <string[]> Required? true Position? Named Accept pipeline input? true (ByPropertyName) Parameter set name propertyValueLiteralPathSet, propertyPSObjectLiteralPathSet Aliases PSPath Dynamic? false -Name <string> Required? true Position? 1 Accept pipeline input? true (ByPropertyName) Parameter set name propertyValuePathSet, propertyValueLiteralPathSet Aliases PSProperty Dynamic? false -PassThru Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases None Dynamic? false -Path <string[]> Required? true Position? 0 Accept pipeline input? true (ByPropertyName) Parameter set name propertyPSObjectPathSet, propertyValuePathSet Aliases None Dynamic? false -UseTransaction Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases usetx Dynamic? false -Value <Object> Required? true Position? 2 Accept pipeline input? true (ByPropertyName) Parameter set name propertyValueLiteralPathSet, propertyValuePathSet Aliases None Dynamic? false -WhatIf Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases wi Dynamic? false
If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''
Tuesday, March 6, 2018 3:42 PM
All replies
-
Set-ItemProperty doesn't have a parameter called type, it may create the type based off of what is supplied in the value. New-ItemProperty has a PropertyType parameter which will do what you want.
PS S:\Scripts\Powershell> get-help set-itemproperty -Parameter * -Confirm Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases cf Dynamic? false -Credential <pscredential> Required? false Position? Named Accept pipeline input? true (ByPropertyName) Parameter set name (All) Aliases None Dynamic? false -Exclude <string[]> Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases None Dynamic? false -Filter <string> Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases None Dynamic? false -Force Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases None Dynamic? false -Include <string[]> Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases None Dynamic? false -InputObject <psobject> Required? true Position? Named Accept pipeline input? true (ByValue, ByPropertyName) Parameter set name propertyPSObjectPathSet, propertyPSObjectLiteralPathSet Aliases None Dynamic? false -LiteralPath <string[]> Required? true Position? Named Accept pipeline input? true (ByPropertyName) Parameter set name propertyValueLiteralPathSet, propertyPSObjectLiteralPathSet Aliases PSPath Dynamic? false -Name <string> Required? true Position? 1 Accept pipeline input? true (ByPropertyName) Parameter set name propertyValuePathSet, propertyValueLiteralPathSet Aliases PSProperty Dynamic? false -PassThru Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases None Dynamic? false -Path <string[]> Required? true Position? 0 Accept pipeline input? true (ByPropertyName) Parameter set name propertyPSObjectPathSet, propertyValuePathSet Aliases None Dynamic? false -UseTransaction Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases usetx Dynamic? false -Value <Object> Required? true Position? 2 Accept pipeline input? true (ByPropertyName) Parameter set name propertyValueLiteralPathSet, propertyValuePathSet Aliases None Dynamic? false -WhatIf Required? false Position? Named Accept pipeline input? false Parameter set name (All) Aliases wi Dynamic? false
If you find that my post has answered your question, please mark it as the answer. If you find my post to be helpful in anyway, please click vote as helpful. (99,108,97,121,109,97,110,50,64,110,121,99,97,112,46,114,114,46,99,111,109|%{[char]$_})-join''
Tuesday, March 6, 2018 3:42 PM -
There is no suck drive as "HKU". It is "HKCU:".
You cannot access other users hives without creating a custom PsDrive.
\_(ツ)_/
Tuesday, March 6, 2018 4:00 PM