Previous Topic: PowerShell Syntax and ParametersNext Topic: Protecting Microsoft SharePoint Environment


PowerShell Examples

Example 1

C:\PS>UDPPowerCLI.ps1 -Command CreatePswFile -password myPlainPassword -passwordFile myPasswordFile
Description

The command encrypts plain passwords that are present in the password file.

Example 2

C:\PS>UDPPowerCLI.ps1 -Command Backup -UDPConsoleUserName myUsr -UDPConsolePassword myPsw -PlanName myPlan
Description

On the local server, the command connects to the UDP Console service with HTTP protocol over port 8015, and then submits an Incremental backup job for the plan named myplan.

Example 3

C:\PS>UDPPowerCLI.ps1 -Command Backup -UDPConsoleUserName myUsr -UDPConsolePasswordFile myUDPPasswordFile -NodeName myNodeName
Description

On the local server, the command connects to the UDP Console service with HTTP protocol over port 8015, and then submits an Incremental backup job for the node named myNodeName.

Example 4

C:\PS>UDPPowerCLI.ps1 -Command Backup -UDPConsoleServerName myServer -UDPConsoleProtocol https -UDPConsolePort 8018 -UDPConsoleUserName myUsr -UDPConsolePassword myPsw -UDPConsoleDomainName myDomain -PlanName myPlan -BackupJobType Full -JobDescription myJob
Description

The command connects to the UDP Console service on the server named myServer with HTTPS protocol over port 8018, and then submits a Full backup job for the plan named myPlan, and set the job description as myJob.

Example 5

C:\PS>UDPPowerCLI.ps1 -Command Backup -UDPAgentServerName yourUDPAgentServer -UDPAgentPasswordFile myUDPAgentPasswordFile -jobType Incr
Description

The command connects to the UDP agent service on the server named yourUDPAgentServer with HTTP protocol over port 8014, and then submits an Incremental backup job for yourUDPAgentServer.

Example 6

C:\PS>UDPPowerCLI.ps1 -Cmd Backup -Svr myServer -Ptc https -Prt 8018 -Usr myUsr -Psw myPsw -Dmn myDomain -Pln myPlan -Jbt Full -Jbd myJob
Description

The command shortens the Parameter name.

Example 7

C:\PS>UDPPowerCLI.ps1 -Command restore -UDPAgentServerName yourUDPAgentServer -UDPAgentPasswordFile myUDPAgentPasswordFile -RestoreDirectoryPath 'c:\Test' -BackupSessionNumber 1
Description

The command connects to the server named yourUDPAgentServer using the user name of the environment, the default HTTP protocol, and port 8014. It verifies the backup session number is 1 from the yourUDPAgentServer backup configuration and then restores the directory to the original location, with the restore option selected as Overwrite existing files.

Example 8

C:\PS>UDPPowerCLI.ps1 -Command restore -UDPAgentServerName yourUDPAgentServer -UDPAgentUserName UDPAgentUsername -UDPAgentPasswordFile myUDPAgentPasswordFile -UDPAgentProtocol 'https' -UDPAgentPort 8018 -UDPAgentDomainName UDPAgentdomainName -BackupSessionNumber 1 -RestoreFilePath 'C:\1.txt' -RestoreDestination 'C:\restore' -RestoreDestinationUserName remoteAccessUser -RestoreDestinationPassword remoteAccessPsw -CreateBaseFolder 'true'
Description

The command connects to the server named yourUDPAgentServer using the HTTPS protocol and port 8018. It verifies the backup session number is 1 from the yourUDPAgentServer backup configuration and then restores the 1.txt file to an alternate location, with the restore option selected as Overwrite existing file and create root directory.

Example 9

C:\PS>UDPPowerCLI.ps1 -Command restore -UDPAgentServerName yourUDPAgentServer -UDPAgentPasswordFile myUDPAgentPasswordFile -RestoreDirectoryPath 'c:\Test' -BackupSessionNumber 1 -RestoreDestination 'C:\restore' -RestoreDestinationUserName remoteAccessUser -RestoreDestinationPassword remoteAccessPsw -servername yourUDPServer -vmname sourceVMName -UDPConsolePasswordFile myUDPPasswordFile -domainname yourUDPDomainName -OverwriteExistFiles 'true' -CreateRootFolder 'true'
Description

The command connects to the server named yourUDPAgentServer using the user name of the environment, the default HTTP protocol, and port 8014. Then, it connects to the UDP server using the default port 8015 and protocol HTTP to check the backup session number is 1. Lastly, it restores the directory to an alternate location, with the restore option selected as Overwrite existing file and create root directory.

Example 10

C:\PS>UDPPowerCLI.ps1 -Command RecoverVM -UDPAgentServerName yourUDPAgentServer -UDPAgentPasswordFile myUDPAgentPasswordFile -BackupSessionNumber 1 -UDPConsoleServerName yourUDPServer -recovervmname  sourceVMName -UDPConsolePasswordFile myUDPPasswordFile -UDPConsoleDomainName yourUDPDomainName -OverwriteExistingVM 'true' -PoweronVM 'true'
Description

The command connects to the server named yourUDPAgentServer using the user name of the environment, the default HTTP protocol, and port 8014. Then, it connects to the UDP server using the default port 8015 and protocol HTTP to check the backup session number is 1. Lastly, it recovers the VM to the original location, with the recover VM option selected as Overwrite existing vm and power on vm after recovered.

Example 11

C:\PS>UDPPowerCLI.ps1 -Command Backup -UDPAgentServerName myServer -UDPAgentPassword myPassword -UDPAgentDomainName myDomainName -UDPAgentUserName myPassword -backupJobType 'incremental' -backupScheduleType 'weekly' -jobDescription 'PowerCLIJob'
Description

The command submits daily, weekly, or monthly backup job on the UDP Agent.

Example 12

C:\PS>UDPPowerCLI.ps1 -Command Backup -UDPConsoleServerName myServer -UDPConsolePasswordFile myPasswordFile -UDPConsoleDomainName myDomainName -nodeName myNodeName -UDPConsoleUserName myAdmin -backupJobType 'incremental' -jobDescription 'PowerCLIJob' -waitJobFinish 'true' -timeout 600 -agentBasedJob 'true'
Description

The command submits weekly backup job on the UDP Agent immediately and runs only one time.