Commandes PowerCLI : Différence entre versions

De DiouxX's Wiki
Aller à : navigation, rechercher
(VM)
Ligne 25 : Ligne 25 :
  
 
* Création à partir d'un template
 
* Création à partir d'un template
<syntaxhighlight>
+
<syntaxhighlight lang=powershell>
New-VM - Name VMName -Template TemplateName -ResourcePool PoolName -Datastore DatastoreName -Location location
+
New-VM -Name "VMName" -Template TemplateName -ResourcePool PoolName -Datastore DatastoreName -Location location
 +
</syntaxhighlight>
 +
 
 +
* Lister les évènements lié à une VM
 +
<syntaxhighlight lang=powershell>
 +
Get-VM -Name "VMName" | Get-VIEvent | Select createdTime, userName, fullFormattedMessage
 
</syntaxhighlight>
 
</syntaxhighlight>
  
 
[[Catégorie:PowerCLI]]
 
[[Catégorie:PowerCLI]]

Version du 18 janvier 2018 à 14:21

Cette page reprend un certains nombre de commande dont j'ai eu besoin

Identification

Création d'un fichier avec identifiant

#Cela stocke les identifiants dans un fichier xml. Vous pouvez ouvrir le fichier xml, mais le mot de passe est haché

New-VICredentialStoreItem -Host ESXorvCenterHostname -User root -Password "Super$ecretPassword" -File C:\vsphere-credential.xml

Utilisation d'un fichier d'identification

#Création de l'objet avec les informations de connexion
$credential = Get-VICredentialStoreItem -File $PathCredentialFile

#Conexion au serveur
$connexion = Connect-VIServer -Server $credential.Host -User $credential.User -Password $credential.Password -WarningAction SilentlyContinue

VM

Création VM

  • Création à partir d'un template
New-VM -Name "VMName" -Template TemplateName -ResourcePool PoolName -Datastore DatastoreName -Location location
  • Lister les évènements lié à une VM
Get-VM -Name "VMName" | Get-VIEvent | Select createdTime, userName, fullFormattedMessage