mirror of
https://github.com/Grace-Solutions/PSProxmox.git
synced 2026-08-08 06:13:15 +00:00
Add comprehensive documentation and examples
This commit is contained in:
@@ -0,0 +1,286 @@
|
||||
# Connect-ProxmoxServer
|
||||
|
||||
Connects to a Proxmox VE server.
|
||||
|
||||
## Syntax
|
||||
|
||||
```powershell
|
||||
Connect-ProxmoxServer
|
||||
-Server <String>
|
||||
-Username <String>
|
||||
-Password <SecureString>
|
||||
[-Realm <String>]
|
||||
[-Port <Int32>]
|
||||
[-UseSSL <Boolean>]
|
||||
[-SkipCertificateValidation <Boolean>]
|
||||
[-Timeout <Int32>]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
```powershell
|
||||
Connect-ProxmoxServer
|
||||
-Server <String>
|
||||
-Credential <PSCredential>
|
||||
[-Realm <String>]
|
||||
[-Port <Int32>]
|
||||
[-UseSSL <Boolean>]
|
||||
[-SkipCertificateValidation <Boolean>]
|
||||
[-Timeout <Int32>]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
```powershell
|
||||
Connect-ProxmoxServer
|
||||
-Server <String>
|
||||
-ApiToken <String>
|
||||
-ApiTokenSecret <SecureString>
|
||||
[-Port <Int32>]
|
||||
[-UseSSL <Boolean>]
|
||||
[-SkipCertificateValidation <Boolean>]
|
||||
[-Timeout <Int32>]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The `Connect-ProxmoxServer` cmdlet establishes a connection to a Proxmox VE server. This connection is required for all other cmdlets in the PSProxmox module.
|
||||
|
||||
## Parameters
|
||||
|
||||
### -Server
|
||||
|
||||
The hostname or IP address of the Proxmox VE server.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Username
|
||||
|
||||
The username to use for authentication.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: UsernamePassword
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Password
|
||||
|
||||
The password to use for authentication.
|
||||
|
||||
```yaml
|
||||
Type: SecureString
|
||||
Parameter Sets: UsernamePassword
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Credential
|
||||
|
||||
The credential object to use for authentication.
|
||||
|
||||
```yaml
|
||||
Type: PSCredential
|
||||
Parameter Sets: Credential
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -ApiToken
|
||||
|
||||
The API token to use for authentication.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: ApiToken
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -ApiTokenSecret
|
||||
|
||||
The API token secret to use for authentication.
|
||||
|
||||
```yaml
|
||||
Type: SecureString
|
||||
Parameter Sets: ApiToken
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Realm
|
||||
|
||||
The authentication realm to use. Default is "pam".
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: UsernamePassword, Credential
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: pam
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Port
|
||||
|
||||
The port to use for the connection. Default is 8006.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: 8006
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -UseSSL
|
||||
|
||||
Whether to use SSL for the connection. Default is $true.
|
||||
|
||||
```yaml
|
||||
Type: Boolean
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: True
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -SkipCertificateValidation
|
||||
|
||||
Whether to skip SSL certificate validation. Default is $false.
|
||||
|
||||
```yaml
|
||||
Type: Boolean
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: False
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Timeout
|
||||
|
||||
The timeout in seconds for the connection. Default is 30.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: 30
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## Inputs
|
||||
|
||||
### None
|
||||
|
||||
## Outputs
|
||||
|
||||
### PSProxmox.Session.ProxmoxConnection
|
||||
|
||||
## Notes
|
||||
|
||||
- This cmdlet must be called before using any other cmdlets in the PSProxmox module.
|
||||
- The connection object is returned and should be stored in a variable for use with other cmdlets.
|
||||
- If you use the `-SkipCertificateValidation` parameter, the SSL certificate validation will be skipped, which is not recommended for production environments.
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Connect to a Proxmox VE server using username and password
|
||||
|
||||
```powershell
|
||||
$securePassword = ConvertTo-SecureString "password" -AsPlainText -Force
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Username "root" -Password $securePassword -Realm "pam"
|
||||
```
|
||||
|
||||
This example connects to a Proxmox VE server using a username and password.
|
||||
|
||||
### Example 2: Connect to a Proxmox VE server using a credential object
|
||||
|
||||
```powershell
|
||||
$credential = Get-Credential
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential $credential -Realm "pam"
|
||||
```
|
||||
|
||||
This example connects to a Proxmox VE server using a credential object.
|
||||
|
||||
### Example 3: Connect to a Proxmox VE server using an API token
|
||||
|
||||
```powershell
|
||||
$secureSecret = ConvertTo-SecureString "secret" -AsPlainText -Force
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -ApiToken "root@pam!token" -ApiTokenSecret $secureSecret
|
||||
```
|
||||
|
||||
This example connects to a Proxmox VE server using an API token.
|
||||
|
||||
### Example 4: Connect to a Proxmox VE server with SSL certificate validation disabled
|
||||
|
||||
```powershell
|
||||
$securePassword = ConvertTo-SecureString "password" -AsPlainText -Force
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Username "root" -Password $securePassword -Realm "pam" -SkipCertificateValidation $true
|
||||
```
|
||||
|
||||
This example connects to a Proxmox VE server with SSL certificate validation disabled.
|
||||
|
||||
## Related Links
|
||||
|
||||
- [Disconnect-ProxmoxServer](Disconnect-ProxmoxServer.md)
|
||||
- [Get-ProxmoxVM](Get-ProxmoxVM.md)
|
||||
- [Get-ProxmoxNode](Get-ProxmoxNode.md)
|
||||
@@ -0,0 +1,151 @@
|
||||
# Get-ProxmoxVM
|
||||
|
||||
Gets virtual machines from Proxmox VE.
|
||||
|
||||
## Syntax
|
||||
|
||||
```powershell
|
||||
Get-ProxmoxVM
|
||||
-Connection <ProxmoxConnection>
|
||||
[-Node <String>]
|
||||
[-VMID <Int32>]
|
||||
[-RawJson]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The `Get-ProxmoxVM` cmdlet retrieves virtual machines from Proxmox VE. You can retrieve all VMs, VMs on a specific node, or a specific VM by ID.
|
||||
|
||||
## Parameters
|
||||
|
||||
### -Connection
|
||||
|
||||
The connection to the Proxmox VE server.
|
||||
|
||||
```yaml
|
||||
Type: ProxmoxConnection
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Node
|
||||
|
||||
The node to get VMs from. If not specified, VMs from all nodes will be returned.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -VMID
|
||||
|
||||
The ID of the VM to get. If not specified, all VMs will be returned.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -RawJson
|
||||
|
||||
Whether to return the raw JSON response instead of parsed objects.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: False
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## Inputs
|
||||
|
||||
### None
|
||||
|
||||
## Outputs
|
||||
|
||||
### PSProxmox.Models.ProxmoxVM
|
||||
|
||||
### System.String
|
||||
|
||||
## Notes
|
||||
|
||||
- This cmdlet requires a connection to a Proxmox VE server. Use `Connect-ProxmoxServer` to establish a connection.
|
||||
- If the `-RawJson` parameter is specified, the raw JSON response will be returned instead of parsed objects.
|
||||
- If the `-VMID` parameter is specified and the VM is not found, an error will be thrown.
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Get all VMs
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$vms = Get-ProxmoxVM -Connection $connection
|
||||
```
|
||||
|
||||
This example gets all VMs from all nodes.
|
||||
|
||||
### Example 2: Get VMs on a specific node
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$vms = Get-ProxmoxVM -Connection $connection -Node "pve1"
|
||||
```
|
||||
|
||||
This example gets all VMs on the node "pve1".
|
||||
|
||||
### Example 3: Get a specific VM by ID
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$vm = Get-ProxmoxVM -Connection $connection -VMID 100
|
||||
```
|
||||
|
||||
This example gets the VM with ID 100.
|
||||
|
||||
### Example 4: Get the raw JSON response
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$json = Get-ProxmoxVM -Connection $connection -RawJson
|
||||
```
|
||||
|
||||
This example gets the raw JSON response for all VMs.
|
||||
|
||||
## Related Links
|
||||
|
||||
- [Connect-ProxmoxServer](Connect-ProxmoxServer.md)
|
||||
- [New-ProxmoxVM](New-ProxmoxVM.md)
|
||||
- [Remove-ProxmoxVM](Remove-ProxmoxVM.md)
|
||||
- [Start-ProxmoxVM](Start-ProxmoxVM.md)
|
||||
- [Stop-ProxmoxVM](Stop-ProxmoxVM.md)
|
||||
- [Restart-ProxmoxVM](Restart-ProxmoxVM.md)
|
||||
@@ -0,0 +1,353 @@
|
||||
# New-ProxmoxVM
|
||||
|
||||
Creates a new virtual machine in Proxmox VE.
|
||||
|
||||
## Syntax
|
||||
|
||||
```powershell
|
||||
New-ProxmoxVM
|
||||
-Connection <ProxmoxConnection>
|
||||
-Node <String>
|
||||
-Name <String>
|
||||
[-VMID <Int32>]
|
||||
[-Memory <Int32>]
|
||||
[-Cores <Int32>]
|
||||
[-Sockets <Int32>]
|
||||
[-DiskSize <Int32>]
|
||||
[-Storage <String>]
|
||||
[-OSType <String>]
|
||||
[-NetworkModel <String>]
|
||||
[-NetworkBridge <String>]
|
||||
[-Description <String>]
|
||||
[-Start]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
```powershell
|
||||
New-ProxmoxVM
|
||||
-Connection <ProxmoxConnection>
|
||||
-Node <String>
|
||||
-Builder <ProxmoxVMBuilder>
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The `New-ProxmoxVM` cmdlet creates a new virtual machine in Proxmox VE. You can specify the VM parameters directly or use a VM builder object.
|
||||
|
||||
## Parameters
|
||||
|
||||
### -Connection
|
||||
|
||||
The connection to the Proxmox VE server.
|
||||
|
||||
```yaml
|
||||
Type: ProxmoxConnection
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Node
|
||||
|
||||
The node to create the VM on.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Name
|
||||
|
||||
The name of the VM to create.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -VMID
|
||||
|
||||
The VM ID. If not specified, the next available ID will be used.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Memory
|
||||
|
||||
The amount of memory in MB.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: 512
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Cores
|
||||
|
||||
The number of CPU cores.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: 1
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Sockets
|
||||
|
||||
The number of CPU sockets.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: 1
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -DiskSize
|
||||
|
||||
The disk size in GB.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: 8
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Storage
|
||||
|
||||
The storage location for the disk.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: local-lvm
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -OSType
|
||||
|
||||
The operating system type.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: l26
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -NetworkModel
|
||||
|
||||
The network interface model.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: virtio
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -NetworkBridge
|
||||
|
||||
The network bridge.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: vmbr0
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Description
|
||||
|
||||
The description of the VM.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Start
|
||||
|
||||
Whether to start the VM after creation.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: Direct
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: False
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Builder
|
||||
|
||||
A VM builder object containing the VM configuration.
|
||||
|
||||
```yaml
|
||||
Type: ProxmoxVMBuilder
|
||||
Parameter Sets: Builder
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## Inputs
|
||||
|
||||
### None
|
||||
|
||||
## Outputs
|
||||
|
||||
### PSProxmox.Models.ProxmoxVM
|
||||
|
||||
## Notes
|
||||
|
||||
- This cmdlet requires a connection to a Proxmox VE server. Use `Connect-ProxmoxServer` to establish a connection.
|
||||
- If the `-VMID` parameter is not specified, the next available ID will be used.
|
||||
- If the `-Start` parameter is specified, the VM will be started after creation.
|
||||
- You can use the `New-ProxmoxVMBuilder` cmdlet to create a VM builder object for more complex VM configurations.
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Create a basic VM
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$vm = New-ProxmoxVM -Connection $connection -Node "pve1" -Name "test-vm" -Memory 2048 -Cores 2 -DiskSize 32 -Start
|
||||
```
|
||||
|
||||
This example creates a new VM with 2 GB of memory, 2 CPU cores, and a 32 GB disk, and starts it.
|
||||
|
||||
### Example 2: Create a VM using a builder
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$builder = New-ProxmoxVMBuilder -Name "web-server"
|
||||
$builder.WithMemory(4096)
|
||||
.WithCores(2)
|
||||
.WithDisk(50, "local-lvm")
|
||||
.WithNetwork("virtio", "vmbr0")
|
||||
.WithIPConfig("192.168.1.10/24", "192.168.1.1")
|
||||
.WithStart($true)
|
||||
|
||||
$vm = New-ProxmoxVM -Connection $connection -Node "pve1" -Builder $builder
|
||||
```
|
||||
|
||||
This example creates a new VM using a builder object with 4 GB of memory, 2 CPU cores, a 50 GB disk, and a static IP address, and starts it.
|
||||
|
||||
### Example 3: Create a VM with a specific ID
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$vm = New-ProxmoxVM -Connection $connection -Node "pve1" -Name "test-vm" -VMID 100 -Memory 2048 -Cores 2 -DiskSize 32
|
||||
```
|
||||
|
||||
This example creates a new VM with ID 100.
|
||||
|
||||
### Example 4: Create a VM with a description
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$vm = New-ProxmoxVM -Connection $connection -Node "pve1" -Name "test-vm" -Memory 2048 -Cores 2 -DiskSize 32 -Description "Test VM for development"
|
||||
```
|
||||
|
||||
This example creates a new VM with a description.
|
||||
|
||||
## Related Links
|
||||
|
||||
- [Connect-ProxmoxServer](Connect-ProxmoxServer.md)
|
||||
- [Get-ProxmoxVM](Get-ProxmoxVM.md)
|
||||
- [Remove-ProxmoxVM](Remove-ProxmoxVM.md)
|
||||
- [Start-ProxmoxVM](Start-ProxmoxVM.md)
|
||||
- [Stop-ProxmoxVM](Stop-ProxmoxVM.md)
|
||||
- [Restart-ProxmoxVM](Restart-ProxmoxVM.md)
|
||||
- [New-ProxmoxVMBuilder](New-ProxmoxVMBuilder.md)
|
||||
@@ -0,0 +1,389 @@
|
||||
# New-ProxmoxVMFromTemplate
|
||||
|
||||
Creates a new virtual machine from a template in Proxmox VE.
|
||||
|
||||
## Syntax
|
||||
|
||||
```powershell
|
||||
New-ProxmoxVMFromTemplate
|
||||
-Connection <ProxmoxConnection>
|
||||
-Node <String>
|
||||
-TemplateName <String>
|
||||
-Name <String>
|
||||
[-VMID <Int32>]
|
||||
[-Memory <Int32>]
|
||||
[-Cores <Int32>]
|
||||
[-DiskSize <Int32>]
|
||||
[-Storage <String>]
|
||||
[-NetworkModel <String>]
|
||||
[-NetworkBridge <String>]
|
||||
[-Description <String>]
|
||||
[-IPPool <String>]
|
||||
[-Start]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
```powershell
|
||||
New-ProxmoxVMFromTemplate
|
||||
-Connection <ProxmoxConnection>
|
||||
-Node <String>
|
||||
-TemplateName <String>
|
||||
-Prefix <String>
|
||||
-Count <Int32>
|
||||
[-StartIndex <Int32>]
|
||||
[-Memory <Int32>]
|
||||
[-Cores <Int32>]
|
||||
[-DiskSize <Int32>]
|
||||
[-Storage <String>]
|
||||
[-NetworkModel <String>]
|
||||
[-NetworkBridge <String>]
|
||||
[-Description <String>]
|
||||
[-IPPool <String>]
|
||||
[-Start]
|
||||
[<CommonParameters>]
|
||||
```
|
||||
|
||||
## Description
|
||||
|
||||
The `New-ProxmoxVMFromTemplate` cmdlet creates a new virtual machine from a template in Proxmox VE. You can create a single VM or multiple VMs with a prefix and counter.
|
||||
|
||||
## Parameters
|
||||
|
||||
### -Connection
|
||||
|
||||
The connection to the Proxmox VE server.
|
||||
|
||||
```yaml
|
||||
Type: ProxmoxConnection
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: 0
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Node
|
||||
|
||||
The node to create the VM on.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -TemplateName
|
||||
|
||||
The name of the template to use.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Name
|
||||
|
||||
The name of the VM to create.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: SingleVM
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Prefix
|
||||
|
||||
The prefix for the VM names when creating multiple VMs.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: MultipleVMs
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Count
|
||||
|
||||
The number of VMs to create.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: MultipleVMs
|
||||
Aliases:
|
||||
|
||||
Required: True
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -StartIndex
|
||||
|
||||
The starting index for the VM names when creating multiple VMs.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: MultipleVMs
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: 1
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -VMID
|
||||
|
||||
The VM ID. If not specified, the next available ID will be used.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: SingleVM
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Memory
|
||||
|
||||
The amount of memory in MB. If specified, overrides the template value.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Cores
|
||||
|
||||
The number of CPU cores. If specified, overrides the template value.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -DiskSize
|
||||
|
||||
The disk size in GB. If specified, overrides the template value.
|
||||
|
||||
```yaml
|
||||
Type: Int32
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Storage
|
||||
|
||||
The storage location for the disk. If specified, overrides the template value.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -NetworkModel
|
||||
|
||||
The network interface model. If specified, overrides the template value.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -NetworkBridge
|
||||
|
||||
The network bridge. If specified, overrides the template value.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Description
|
||||
|
||||
The description of the VM. If specified, overrides the template value.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -IPPool
|
||||
|
||||
The IP pool to use for assigning an IP address.
|
||||
|
||||
```yaml
|
||||
Type: String
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: None
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### -Start
|
||||
|
||||
Whether to start the VM after creation.
|
||||
|
||||
```yaml
|
||||
Type: SwitchParameter
|
||||
Parameter Sets: (All)
|
||||
Aliases:
|
||||
|
||||
Required: False
|
||||
Position: Named
|
||||
Default value: False
|
||||
Accept pipeline input: False
|
||||
Accept wildcard characters: False
|
||||
```
|
||||
|
||||
### CommonParameters
|
||||
|
||||
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216).
|
||||
|
||||
## Inputs
|
||||
|
||||
### None
|
||||
|
||||
## Outputs
|
||||
|
||||
### PSProxmox.Models.ProxmoxVM
|
||||
|
||||
## Notes
|
||||
|
||||
- This cmdlet requires a connection to a Proxmox VE server. Use `Connect-ProxmoxServer` to establish a connection.
|
||||
- If the `-VMID` parameter is not specified, the next available ID will be used.
|
||||
- If the `-Start` parameter is specified, the VM will be started after creation.
|
||||
- If the `-IPPool` parameter is specified, an IP address will be assigned from the specified pool.
|
||||
- When creating multiple VMs, the names will be in the format `{Prefix}{StartIndex + i}` where `i` is the index of the VM (0 to Count-1).
|
||||
|
||||
## Examples
|
||||
|
||||
### Example 1: Create a VM from a template
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$vm = New-ProxmoxVMFromTemplate -Connection $connection -Node "pve1" -TemplateName "Ubuntu-Template" -Name "web01" -Start
|
||||
```
|
||||
|
||||
This example creates a new VM from the "Ubuntu-Template" template and starts it.
|
||||
|
||||
### Example 2: Create multiple VMs from a template
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$vms = New-ProxmoxVMFromTemplate -Connection $connection -Node "pve1" -TemplateName "Ubuntu-Template" -Prefix "web" -Count 3 -Start
|
||||
```
|
||||
|
||||
This example creates three new VMs from the "Ubuntu-Template" template with names "web1", "web2", and "web3", and starts them.
|
||||
|
||||
### Example 3: Create a VM from a template with custom settings
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$vm = New-ProxmoxVMFromTemplate -Connection $connection -Node "pve1" -TemplateName "Ubuntu-Template" -Name "web01" -Memory 4096 -Cores 2 -DiskSize 50 -Start
|
||||
```
|
||||
|
||||
This example creates a new VM from the "Ubuntu-Template" template with 4 GB of memory, 2 CPU cores, and a 50 GB disk, and starts it.
|
||||
|
||||
### Example 4: Create a VM from a template with an IP from a pool
|
||||
|
||||
```powershell
|
||||
$connection = Connect-ProxmoxServer -Server "proxmox.example.com" -Credential (Get-Credential)
|
||||
$vm = New-ProxmoxVMFromTemplate -Connection $connection -Node "pve1" -TemplateName "Ubuntu-Template" -Name "web01" -IPPool "Production" -Start
|
||||
```
|
||||
|
||||
This example creates a new VM from the "Ubuntu-Template" template, assigns an IP address from the "Production" pool, and starts it.
|
||||
|
||||
## Related Links
|
||||
|
||||
- [Connect-ProxmoxServer](Connect-ProxmoxServer.md)
|
||||
- [Get-ProxmoxVM](Get-ProxmoxVM.md)
|
||||
- [New-ProxmoxVM](New-ProxmoxVM.md)
|
||||
- [Get-ProxmoxVMTemplate](Get-ProxmoxVMTemplate.md)
|
||||
- [New-ProxmoxVMTemplate](New-ProxmoxVMTemplate.md)
|
||||
- [New-ProxmoxIPPool](New-ProxmoxIPPool.md)
|
||||
@@ -0,0 +1,81 @@
|
||||
# PSProxmox Cmdlets
|
||||
|
||||
This directory contains documentation for all cmdlets in the PSProxmox module.
|
||||
|
||||
## Cmdlet Categories
|
||||
|
||||
- [Session Management](#session-management)
|
||||
- [VM Management](#vm-management)
|
||||
- [Storage Management](#storage-management)
|
||||
- [Network Management](#network-management)
|
||||
- [User and Role Management](#user-and-role-management)
|
||||
- [SDN Management](#sdn-management)
|
||||
- [Cluster Management](#cluster-management)
|
||||
- [Template Management](#template-management)
|
||||
- [IP Management](#ip-management)
|
||||
|
||||
## Session Management
|
||||
|
||||
- [Connect-ProxmoxServer](Connect-ProxmoxServer.md) - Connects to a Proxmox VE server
|
||||
- [Disconnect-ProxmoxServer](Disconnect-ProxmoxServer.md) - Disconnects from a Proxmox VE server
|
||||
|
||||
## VM Management
|
||||
|
||||
- [Get-ProxmoxVM](Get-ProxmoxVM.md) - Gets virtual machines from Proxmox VE
|
||||
- [New-ProxmoxVM](New-ProxmoxVM.md) - Creates a new virtual machine in Proxmox VE
|
||||
- [Remove-ProxmoxVM](Remove-ProxmoxVM.md) - Removes a virtual machine from Proxmox VE
|
||||
- [Start-ProxmoxVM](Start-ProxmoxVM.md) - Starts a virtual machine in Proxmox VE
|
||||
- [Stop-ProxmoxVM](Stop-ProxmoxVM.md) - Stops a virtual machine in Proxmox VE
|
||||
- [Restart-ProxmoxVM](Restart-ProxmoxVM.md) - Restarts a virtual machine in Proxmox VE
|
||||
|
||||
## Storage Management
|
||||
|
||||
- [Get-ProxmoxStorage](Get-ProxmoxStorage.md) - Gets storage from Proxmox VE
|
||||
- [New-ProxmoxStorage](New-ProxmoxStorage.md) - Creates a new storage in Proxmox VE
|
||||
- [Remove-ProxmoxStorage](Remove-ProxmoxStorage.md) - Removes a storage from Proxmox VE
|
||||
|
||||
## Network Management
|
||||
|
||||
- [Get-ProxmoxNetwork](Get-ProxmoxNetwork.md) - Gets network interfaces from Proxmox VE
|
||||
- [New-ProxmoxNetwork](New-ProxmoxNetwork.md) - Creates a new network interface in Proxmox VE
|
||||
- [Remove-ProxmoxNetwork](Remove-ProxmoxNetwork.md) - Removes a network interface from Proxmox VE
|
||||
|
||||
## User and Role Management
|
||||
|
||||
- [Get-ProxmoxUser](Get-ProxmoxUser.md) - Gets users from Proxmox VE
|
||||
- [New-ProxmoxUser](New-ProxmoxUser.md) - Creates a new user in Proxmox VE
|
||||
- [Remove-ProxmoxUser](Remove-ProxmoxUser.md) - Removes a user from Proxmox VE
|
||||
- [Get-ProxmoxRole](Get-ProxmoxRole.md) - Gets roles from Proxmox VE
|
||||
- [New-ProxmoxRole](New-ProxmoxRole.md) - Creates a new role in Proxmox VE
|
||||
- [Remove-ProxmoxRole](Remove-ProxmoxRole.md) - Removes a role from Proxmox VE
|
||||
|
||||
## SDN Management
|
||||
|
||||
- [Get-ProxmoxSDNZone](Get-ProxmoxSDNZone.md) - Gets SDN zones from Proxmox VE
|
||||
- [New-ProxmoxSDNZone](New-ProxmoxSDNZone.md) - Creates a new SDN zone in Proxmox VE
|
||||
- [Remove-ProxmoxSDNZone](Remove-ProxmoxSDNZone.md) - Removes an SDN zone from Proxmox VE
|
||||
- [Get-ProxmoxSDNVnet](Get-ProxmoxSDNVnet.md) - Gets SDN VNets from Proxmox VE
|
||||
- [New-ProxmoxSDNVnet](New-ProxmoxSDNVnet.md) - Creates a new SDN VNet in Proxmox VE
|
||||
- [Remove-ProxmoxSDNVnet](Remove-ProxmoxSDNVnet.md) - Removes an SDN VNet from Proxmox VE
|
||||
|
||||
## Cluster Management
|
||||
|
||||
- [Get-ProxmoxCluster](Get-ProxmoxCluster.md) - Gets cluster information from Proxmox VE
|
||||
- [Join-ProxmoxCluster](Join-ProxmoxCluster.md) - Joins a node to a Proxmox VE cluster
|
||||
- [Leave-ProxmoxCluster](Leave-ProxmoxCluster.md) - Removes a node from a Proxmox VE cluster
|
||||
- [Get-ProxmoxClusterBackup](Get-ProxmoxClusterBackup.md) - Gets cluster backups from Proxmox VE
|
||||
- [New-ProxmoxClusterBackup](New-ProxmoxClusterBackup.md) - Creates a new cluster backup in Proxmox VE
|
||||
- [Restore-ProxmoxClusterBackup](Restore-ProxmoxClusterBackup.md) - Restores a cluster backup in Proxmox VE
|
||||
|
||||
## Template Management
|
||||
|
||||
- [Get-ProxmoxVMTemplate](Get-ProxmoxVMTemplate.md) - Gets VM templates from Proxmox VE
|
||||
- [New-ProxmoxVMTemplate](New-ProxmoxVMTemplate.md) - Creates a new VM template in Proxmox VE
|
||||
- [Remove-ProxmoxVMTemplate](Remove-ProxmoxVMTemplate.md) - Removes a VM template from Proxmox VE
|
||||
- [New-ProxmoxVMFromTemplate](New-ProxmoxVMFromTemplate.md) - Creates a new VM from a template in Proxmox VE
|
||||
|
||||
## IP Management
|
||||
|
||||
- [New-ProxmoxIPPool](New-ProxmoxIPPool.md) - Creates a new IP pool
|
||||
- [Get-ProxmoxIPPool](Get-ProxmoxIPPool.md) - Gets IP pools
|
||||
- [Clear-ProxmoxIPPool](Clear-ProxmoxIPPool.md) - Clears an IP pool
|
||||
Reference in New Issue
Block a user