SCVMM Powershell Scripts


I have been working on setting up a shared VMM configuration where I have multiple servers that are shared with multiple developers (they each have their own server but all ties into the same SCVMM.

I copied over VMs, ISO, and Templates to the individual servers but I wanted the resources on each server to be defined as belonging to the developer using it.

But when you copy them they all show as unknown…… now I am lazy and don’t want to go to the properties of each object and set the owner, and powershell being the wonderful thing it is made this easy so here is my “owner script”

You can run as individual 1 liners or save all together as a single .ps1 file

 

*************************************************************

Get-vmmserver localhost

#Set all TEMPLATES on SERVER1 to USER_ONE

Get-Template | ? {$_.LibraryServer -EQ "SERVER1.LAB.LOCAL"} | Set-Template -Owner USER_ONE | FT name, owner

#Set all ISO on SERVER1 to USER_ONE

Get-iso | ? {$_.LibraryServer -EQ "SERVER1.LAB.LOCAL"} | Set-iso -Owner USER_ONE | FT name, owner

#Set VM on SERVER1 to USER_ONE

get-VM | ? {$_.LibraryServer -EQ "SERVER1.LAB.LOCAL"} | Set-VM -Owner USER_ONE | FT name, owner

get-VM | ? {$_.VMHOst -EQ "SERVER1.LAB.LOCAL"} | Set-VM -Owner USER_ONE | FT name, owner

#Set VHD on SERVER1 to USER_ONE

Get-VirtualHardDisk | ? {$_.LibraryServer -EQ "SERVER1.LAB.LOCAL"} | Set-VirtualHardDisk -Owner USER_ONE | FT name, owner

 

****************************************************************

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s