Quantcast
Channel: VMware Communities: Message List
Viewing all articles
Browse latest Browse all 183620

automatic upload to datastore

$
0
0

Got a quick&dirty "script" to upload all my ISO-Files into a fresh datastore.

Will use it as base base for an upcomming "sync-script" for my datastore...

Maybe someone could use it.

 

# Import the PowerCLI module

Add-PSSnapin VMware.VimAutomation.Core

# some stuff to enter ;-)

$vCenterServer = "10.1.2.3" # IP or Hostname of your vCenterServer

$vCenterUser = "domain\user" # User with administrator permission

$vCenterPass = "Password123" # Password

$datastore = "Synology" # Enter your Datastore

$destination = "\DSL" # define the path to your Library in the datastore

$source = "D:\ISOs\*.iso" # define the Source Folder

# mammut script :-D

Connect-VIServer $vCenterServer -User $vCenterUser -Password $vCenterPass

$ds = Get-Datastore $datastore

New-PSDrive -Location $ds -Name ds -PSProvider VimDatastore -Root $destination

Set-Location ds:\

Copy-DatastoreItem -Item $source -Destination $destination

Disconnect-ViServer


Viewing all articles
Browse latest Browse all 183620

Trending Articles



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