Quantcast
Channel: TechNet Blogs
Viewing all articles
Browse latest Browse all 36188

PowerTip: Use Set-Variable to Create a ReadOnly PowerShell Variable

$
0
0

Summary: Use the Set-Variable cmdlet to create a ReadOnly Windows PowerShell variable.

Hey, Scripting Guy! Question How can I create a ReadOnly variable in Windows PowerShell?

Hey, Scripting Guy! Answer Use the Set-Variable cmdlet to create a ReadOnly variable, and specify ReadOnly for the Option parameter, and you can specify a description for the variable:

Set-Variable -Name myvariable -Value "value" -Description "mred variable" -Option readonly

 


Viewing all articles
Browse latest Browse all 36188

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>