VMware Communities
DonCroooks
Enthusiast
Enthusiast

How to use powershell script to automate datastore removal

Hi,

I just downloaded the script located here: http://communities.vmware.com/docs/DOC-18008

I am having a hard time trying to figure out how to use it.  It looks like it bundles some built-in powershell commands into more advanced functions to read in datastores you want to have removed and then carry out the process of removing them.

How do I get this in there?  Do I need to install the script into powershell some place or do I pipe to it?

Thanks in advance for your assistance,

Don

Reply
0 Kudos
1 Reply
Grzesiekk
Expert
Expert

hi Don,

  if you have already powercli installed, open it. If you have downloaded this file for example to c:\newfuntions.ps1

while being in powercli please type:

. c:\newfunctions.ps1

By this you will source this file and will gain those functions in your current powercli session.

If you want to use them simple write for example:

Get-Datastore | Get-DatastoreMountInfo | Sort Datastore, VMHost | FT -AutoSize

You have examples in this file at the end.

I hope that helps.

Greg

--- @blog https://grzegorzkulikowski.info
Reply
0 Kudos