Skip to content

Commit c8e1b52

Browse files
authored
Merge pull request microsoft#110 from jwittner/dev/addLicenseDoc
Add license documentation
2 parents 6445e9f + b9eaad7 commit c8e1b52

File tree

2 files changed

+45
-2
lines changed

2 files changed

+45
-2
lines changed

README.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,28 @@ Find-UnitySetupInstaller -Version '2017.3.0f3' | Install-UnitySetupInstance
115115
Install-UnitySetupInstance -Installers (Find-UnitySetupInstaller -Version '2017.3.0f3')
116116
```
117117

118+
Manage Unity licenses.
119+
```powershell
120+
# Get any active licenses
121+
Get-UnityLicense
122+
123+
# Example Output:
124+
# LicenseVersion : 6.x
125+
# Serial : System.Security.SecureString
126+
# UnityVersion : 2017.4.2f2
127+
# DisplaySerial : AB-CDEF-GHIJ-KLMN-OPQR-XXXX
128+
# ActivationDate : 2017-07-13 16:32:16
129+
# StartDate : 2017-07-12 00:00:00
130+
# StopDate : 2019-01-01 00:00:00
131+
# UpdateDate : 2018-05-11 23:47:10
132+
133+
# Activate a license
134+
Start-UnityEditor -Credential <unityAccount> -Serial <unitySerial> -Wait
135+
136+
# Return license
137+
Start-UnityEditor -Credential <unityAccount> -ReturnLicense -Wait
138+
```
139+
118140
### DSC
119141
UnitySetup includes the xUnitySetupInstance DSC Resource. An example configuration might look like:
120142

@@ -123,16 +145,29 @@ UnitySetup includes the xUnitySetupInstance DSC Resource. An example configurati
123145
Install multiple versions of Unity and several components
124146
#>
125147
Configuration Sample_xUnitySetupInstance_Install {
148+
param(
149+
[PSCredential]$UnityCredential,
150+
[PSCredential]$UnitySerial
151+
)
126152
127153
Import-DscResource -ModuleName UnitySetup
128154
129155
Node 'localhost' {
130156
131157
xUnitySetupInstance Unity {
132-
Versions = '2017.3.1f1,2018.1.0b9'
158+
Versions = '2017.4.2f2,2018.1.0f2'
133159
Components = 'Windows', 'Mac', 'Linux', 'Metro', 'iOS'
134160
Ensure = 'Present'
135161
}
162+
163+
xUnityLicense UnityLicense {
164+
Name = 'UL01'
165+
Credential = $UnityCredential
166+
Serial = $UnitySerial
167+
Ensure = 'Present'
168+
UnityVersion = '2017.4.2f2'
169+
DependsOn = '[xUnitySetupInstance]Unity'
170+
}
136171
}
137172
}
138173
```

UnitySetup/UnitySetup.psm1

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -990,10 +990,18 @@ function ConvertTo-DateTime {
990990
else { [DateTime]$Text }
991991
}
992992

993+
<#
994+
.Synopsis
995+
Get the active Unity licenses for the machine.
996+
.PARAMETER Serial
997+
Filter licenses to the specified serial
998+
.EXAMPLE
999+
Get-UnityLicense
1000+
#>
9931001
function Get-UnityLicense
9941002
{
9951003
[CmdletBinding()]
996-
param([SecureString]$Serial, [UnityVersion]$UnityVersion)
1004+
param([SecureString]$Serial)
9971005

9981006
$licenseFiles = Get-ChildItem "C:\ProgramData\Unity\Unity_*.ulf" -ErrorAction 'SilentlyContinue'
9991007
foreach ( $licenseFile in $licenseFiles ) {

0 commit comments

Comments
 (0)