VM Lab – Read Only status

In this next installment of my  VM Lab series of posts, I have created a tiny set of tools which basically do exactly as the names imply.
While I admit, not quite hard to do, perhaps you’d even prefer to type things manually, but as mentioned in my previous post, for me it’s all about re-usability.

Requirements

In one of the upcoming installments of my VM Lab series, I will create a template VHD file, which will need to be set to Read Only in order to prevent changes to be made accidentally.
In another, I will need to copy a current Unattend.xml file, check if it was set to Read Only and if it was, remove that value so we can customize the contents.

So I made a small set of tools that did just that.

Functions

As the scripts aren’t too complex, but do server a solid purpose for the rest of the series, I’ve provided the code below.

BEWARE

These functions are meant for a test environment.
I’ve borrowed Jeffery Hicks‘ disclaimer, because it simply says it all:

DO NOT USE IN A PRODUCTION ENVIRONMENT UNTIL YOU HAVE TESTED THOROUGHLY IN A LAB ENVIRONMENT.
USE AT YOUR OWN RISK.
IF YOU DO NOT UNDERSTAND WHAT THIS SCRIPT DOES OR HOW IT WORKS, DO NOT USE IT OUTSIDE OF A SECURE, TEST SETTING.

I’ve set the scripts to a max height as to not flood the page, but rest assured, everything’s there.
Please do note that functions might refer to other functions, this is intended as a complete toolset, not just 1 piece.

If you have questions on the techniques used or suggestions on how to improve something, please let me know in the comment section!

Get-ReadOnly

Set-ReadOnly

Remove-ReadOnly

 

Facebooktwittergoogle_plusredditpinterestlinkedinmail

Robert

It never hurts to Get-Help

One thought on “VM Lab – Read Only status

Leave a Reply

Your email address will not be published. Required fields are marked *