-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathBasicSample.ps1
More file actions
73 lines (56 loc) · 2.22 KB
/
Copy pathBasicSample.ps1
File metadata and controls
73 lines (56 loc) · 2.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
## ==================================================================
##
## Copyright (c) 2005-2019 Parallels Software International, Inc.
## Released under the terms of MIT license (see LICENSE for details)
##
## ==================================================================
<#
.SYNOPSIS
RAS PowerShell Basic Examples
.DESCRIPTION
Examples to demonstrates how to start a session, add major objects to a site, publish a desktop, activate a license, apply the changes, and finally end the session.
.NOTES
File Name : BasicSample.ps1
Author : www.parallels.com
.EXAMPLE
.\BasicSample.ps1
#>
CLS
#Pre-set Params
$GWServer = "gw.company.dom" #(replace 'gw.company.dom' with a valid FQDN, computer name, or IP address).
$RDSServer = "rds.company.dom" #(replace 'rds.company.dom' with a valid FQDN, computer name, or IP address).
$PubDeskName = "PubDesktop" #(replace with a more specific name).
$LicenseKey = "YOUR-LICENSE-KEY" #(replace with a valid Parallels RAS License key).
#Configure logging
function log
{
param([string]$message)
"`n`n$(get-date -f o) $message"
}
Import-Module RASAdmin
#Establish a connection with Parallels RAS (NB. User will be prompted for Username and Password)
log "Creating RAS session"
New-RASSession
#Add a RAS Secure Gateway.
log "Adding new RAS Secure Gateway"
New-RASGateway -Server $GWServer
#Add an RD Session Host server.
log "Adding new RD Session Host server"
New-RASRDSHost -Server $RDSServer
#Add a published desktop.
log "Adding new RDS published desktop"
New-RASPubRDSDesktop -Name $PubDeskName
#Activate Parallels RAS as a trial (you will have to provide a valid Parallels My Account email and password).
log "Activating Parallels RAS as a trial"
Invoke-RASLicenseActivate
#Activate Parallels RAS License. If you have a valid Parallels RAS License key use the below license activation
#(you will have to provide a valid Parallels My Account email and password)
#log "Activating Parallels RAS"
#Invoke-RASLicenseActivate -Key $LicenseKey
#Apply all settings. This cmdlet performs the same action as the Apply button in the RAS console.
log "Appling settings"
Invoke-RASApply
#End the current RAS session.
log "Ending RAS session"
Remove-RASSession
log "All Done"