VMware Horizon Community
ekisner
Contributor
Contributor

Script a change in VMDK Persistence

There's an option in the VM settings to make a HDD persistent or nonpersistent.

I'm tired of my users breaking their computers... installing viruses, programs that should not be on them... whatever it is that they do. I'm tired of it.

So, we're going to start using VMware View. I'm going to make virtual machines for all of my "information workers" (not the power users that need things like AutoCAD) and I'm going to have them all use thin clients to get to their Virtual Desktop.

And, to make it so that I never have to fix another problem again, I'm going to make the systemroot drive non-persistent. I've got a seperate VMDK which will remain persistent that will hold the Documents and Settings folder.

Unfortuantely, that means that any and all windows updates (antivirus will be installed on the persistent VMDK) will need to be installed by some other means... as otherwise, the updates will just get thrown out as soon as the computer reboots.

My solution? I've set up the global policy in my test VM to manually install once per week at 3am.

I would like to know if there is a way to set up a cron job that will automatically change the persistency of a list of VMDKs (or a list of VMs), and then make another job which does the opposite.

0 Kudos
3 Replies
weinstein5
Immortal
Immortal

I believe view will handle that with out having to use persistent and non-persistent - hopefully one of the moderators will move this the Enterprise Desktop Board for further cladification -

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful

If you find this or any other answer useful please consider awarding points by marking the answer correct or helpful
0 Kudos
depping
Leadership
Leadership

Moved it to VMware View forum.

Duncan

Blogging:

If you find this information useful, please award points for "correct" or "helpful".

0 Kudos
ekisner
Contributor
Contributor

No, this was not a VMware View question, it was directly related to ESX.

This was a question which is answered by the following (and the opposite of the following). Stumbled on the vmware-cmd command by accident and it solved all my problems.

Edit: The forum seemed to kill my code pretty good... will see if I can repost it in a better way.

#!/bin/bash

for i in $( vmware-cmd -l | grep VDI-Colleen );

do

state=$( vmware-cmd "$i" getstate -q );

if

then

echo $i is currently turned on. Trying to turn off.

output=`vmware-cmd "$i" stop trysoft`

while

do

echo -n .

sleep 5

state=`vmware-cmd "$i" getstate -q`;

done

fi

echo $i current state is $state

echo

echo $i is currently set to:

vmware-cmd "$i" getconfig scsi0:0.mode

echo

echo Changing to nonpersistent

vmware-cmd "$i" setconfig scsi0:0.mode independent-nonpersistent

state=$( vmware-cmd "$i" getstate -q );

if

then

echo $i is currently turned off. Trying to turn on.

vmware-cmd "$i" start

fi

echo

done

0 Kudos