0

I am using Set-ItemProperty to set a registry key in a new PS script that I am writing. Since the script can run on different PS versions, I am wondering if the cmdlet could have problems with any specific PS version.

So my question is, does the cmdlet Set-ItemProperty has any dependency on the PS version.

1 Answer 1

1

The cmdlet exists since PowerShell v1 and as far as I know its semantics didn't change since then.

If you use features that are only available in later versions, you can use a #requires comment at the start of your script, e.g.:

#Requires -Version 3.0
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you for your response. When I went to technet.microsoft.com/en-us/library/hh849844.aspx, it showed only versions 3 and 4 (in the 'Show Other Versions' dropdown). That made me ask this question!
Technet seems to only have documentation for PowerShell v3 and v4 in general there. But accessing registry keys via Get/SetItemProperty was possible in v1 already, so I think you're good.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.