Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
6ba5f79
Support for Mac for Get-UnitySetupInstance.
Ziugy Apr 2, 2018
c5438f6
Redirect standard streams for Start-UnityEditor
jwittner Apr 2, 2018
692c6f9
No more write-host for Install-UnitySetupInstance
jwittner Apr 2, 2018
e624b8e
Handles Mac paths in UnitySetupInstance.
Ziugy Apr 3, 2018
3138d7f
Merge pull request #93 from jwittner/fix/missingPatchVersions
derekfreed Apr 5, 2018
519d1a9
Fixes Start-UnityEditor on Mac OS.
Apr 12, 2018
95bbc2c
Fixes 'All' flag to be the next increment.
Ziugy Apr 12, 2018
28beadf
Merges the latest from remote.
Ziugy Apr 12, 2018
b72c4df
Merge pull request #90 from jwittner/fix/unityExitSpew
jwittner Apr 12, 2018
ba790c9
Merge pull request #91 from jwittner/fix/unityInstallSpam
jwittner Apr 12, 2018
3f26666
Merges in latest from the remote to resolve merge issues.
Ziugy Apr 12, 2018
67df711
Better cross platform support and bails out when on a platform that's…
Ziugy Apr 13, 2018
8fa0a3d
Adds .OUTPUTS to the Get-OperatingSystem documentation.
Ziugy Apr 13, 2018
9e88eda
Version bump for incoming changes
jwittner Apr 16, 2018
ce12d56
Merge pull request #99 from jwittner/dev/versionBump
jwittner Apr 16, 2018
d3dae74
Merge pull request #98 from Ziugy/develop
jwittner Apr 16, 2018
7cf05df
Added AcceptAPIUpdate parameter.
jwittner Apr 27, 2018
dd41ce1
Merge pull request #101 from jwittner/dev/supportAPIUpdater
derekfreed Apr 27, 2018
cffd925
Made 'Project' parameter positional on Start cmd
Apr 27, 2018
f09d79c
Merge pull request #102 from mister-liss/dev/project
jwittner Apr 27, 2018
5d9b4fc
Wait in the Start-Process call.
jwittner Apr 27, 2018
0f40282
Merge pull request #103 from jwittner/fix/exitCodeCheck
derekfreed Apr 30, 2018
1db828e
Add license query and management support
jwittner Apr 27, 2018
81767a7
Merge pull request #105 from jwittner/dev/licenseDSCResource
derekfreed May 1, 2018
b1c66b4
License DSC Fixes and Sample improvement
jwittner May 1, 2018
8cc66e1
Merge pull request #106 from jwittner/dev/licenseDSCResource
jwittner May 1, 2018
8bcafa3
Fix for missing folders
jwittner May 1, 2018
46b0561
Merge pull request #107 from jwittner/dev/licenseDSCResource
jwittner May 1, 2018
2d28258
Added copyrights
jwittner May 10, 2018
63fb834
Added security contact info
jwittner May 10, 2018
d239d56
Add license documentation
jwittner May 16, 2018
ef10610
Merge pull request #108 from jwittner/dev/copyrights
Ziugy May 16, 2018
6445e9f
Merge pull request #109 from jwittner/dev/securityContactInfo
Ziugy May 16, 2018
b9eaad7
Document Get-UnityLicense
jwittner May 16, 2018
c8e1b52
Merge pull request #110 from jwittner/dev/addLicenseDoc
Ziugy May 16, 2018
68c0ee8
Suppress inappropraitely applied rule
jwittner May 21, 2018
af1bd39
Merge pull request #112 from jwittner/dev/suppressAnalyazerMessage
jwittner May 21, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 75 additions & 35 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,19 @@ Find all of your Unity installs:
Get-UnitySetupInstance

# Example output:
# Version Components Path
# ------- ---------- ----
# 2017.1.2f1 Setup, Metro, UWP_IL2CPP C:\Program Files\Unity-2017.1.2f1\
# 2017.1.3f1 Setup, Metro, UWP_IL2CPP C:\Program Files\Unity-2017.1.3f1\
# 2017.2.1f1 Setup, Metro, UWP_IL2CPP C:\Program Files\Unity-2017.2.1f1\
# 2017.3.1f1 Setup, Metro, UWP_IL2CPP, Linux, Vuforia C:\Program Files\Unity-2017.3.1f1\
# 2018.1.0b4 Setup, Metro, UWP_IL2CPP, Vuforia C:\Program Files\Unity-2018.1.0b4\
# 2018.1.0b8 All C:\Program Files\Unity-2018.1.0b8\
# 2017.1.0p5 Setup, Metro, UWP_IL2CPP C:\Program Files\Unity.2017.1.0p5\
# 2017.1.1f1 Setup, Metro, UWP_IL2CPP C:\Program Files\Unity.2017.1.1f1\
# 2017.1.1p3 Setup, StandardAssets, Metro, UWP_IL2CPP C:\Program Files\Unity.2017.1.1p3\
# 2017.2.0f3 Setup, Metro, UWP_IL2CPP, Vuforia C:\Program Files\Unity.2017.2.0f3\
# 2017.3.0f3 Setup, Metro, UWP_IL2CPP, Mac, Vuforia C:\Program Files\Unity.2017.3.0f3\
# Version Components Path
# ------- ---------- ----
# 2017.1.2f1 Windows, Metro, UWP_IL2CPP C:\Program Files\Unity-2017.1.2f1\
# 2017.1.3f1 Windows, Metro, UWP_IL2CPP C:\Program Files\Unity-2017.1.3f1\
# 2017.2.1f1 Windows, Metro, UWP_IL2CPP C:\Program Files\Unity-2017.2.1f1\
# 2017.3.1f1 Windows, Metro, UWP_IL2CPP, Linux, Vuforia C:\Program Files\Unity-2017.3.1f1\
# 2018.1.0b4 Windows, Metro, UWP_IL2CPP, Vuforia C:\Program Files\Unity-2018.1.0b4\
# 2018.1.0b8 All C:\Program Files\Unity-2018.1.0b8\
# 2017.1.0p5 Windows, Metro, UWP_IL2CPP C:\Program Files\Unity.2017.1.0p5\
# 2017.1.1f1 Windows, Metro, UWP_IL2CPP C:\Program Files\Unity.2017.1.1f1\
# 2017.1.1p3 Windows, StandardAssets, Metro, UWP_IL2CPP C:\Program Files\Unity.2017.1.1p3\
# 2017.2.0f3 Windows, Metro, UWP_IL2CPP, Vuforia C:\Program Files\Unity.2017.2.0f3\
# 2017.3.0f3 Windows, Metro, UWP_IL2CPP, Mac, Vuforia C:\Program Files\Unity.2017.3.0f3\
```

Select the Unity installs that you want:
Expand Down Expand Up @@ -78,31 +78,32 @@ Find the installers for a particular version:
Find-UnitySetupInstaller -Version '2017.3.0f3' | Format-Table

# Example output:
# ComponentType Version Length LastModified DownloadUrl
# ------------- ------- ------ ------------ -----------
# Setup 2017.3.0f3 553688024 2017-12-18 08:15:20 https://netstorage.unity3d.com/unity/...
# Documentation 2017.3.0f3 358911256 2017-12-18 08:18:37 https://netstorage.unity3d.com/unity/...
# StandardAssets 2017.3.0f3 189886032 2017-12-18 08:15:52 https://netstorage.unity3d.com/unity/...
# Metro 2017.3.0f3 172298008 2017-12-18 08:17:44 https://netstorage.unity3d.com/unity/...
# UWP_IL2CPP 2017.3.0f3 152933480 2017-12-18 08:17:55 https://netstorage.unity3d.com/unity/...
# Android 2017.3.0f3 194240888 2017-12-18 08:16:06 https://netstorage.unity3d.com/unity/...
# iOS 2017.3.0f3 802853872 2017-12-18 08:17:21 https://netstorage.unity3d.com/unity/...
# AppleTV 2017.3.0f3 273433528 2017-12-18 08:16:24 https://netstorage.unity3d.com/unity/...
# Facebook 2017.3.0f3 32131560 2017-12-18 08:16:27 https://netstorage.unity3d.com/unity/...
# Linux 2017.3.0f3 122271984 2017-12-18 08:17:30 https://netstorage.unity3d.com/unity/...
# Vuforia 2017.3.0f3 65677296 2017-12-18 08:18:00 https://netstorage.unity3d.com/unity/...
# WebGL 2017.3.0f3 134133288 2017-12-18 08:18:09 https://netstorage.unity3d.com/unity/...
# ComponentType Version Length LastModified DownloadUrl
# ------------- ------- ------ ------------ -----------
# Windows 2017.3.0f3 553688024 12/18/2017 8:05:31 AM https://download.unity3d.com/download_unity/...
# Linux 2017.3.0f3 122271984 12/18/2017 8:06:53 AM https://download.unity3d.com/download_unity/...
# Mac 2017.3.0f3 28103888 12/18/2017 8:06:53 AM https://download.unity3d.com/download_unity/...
# Documentation 2017.3.0f3 358911256 12/18/2017 8:07:34 AM https://download.unity3d.com/download_unity/...
# StandardAssets 2017.3.0f3 189886032 12/18/2017 8:05:50 AM https://download.unity3d.com/download_unity/...
# Metro 2017.3.0f3 172298008 12/18/2017 8:07:04 AM https://download.unity3d.com/download_unity/...
# UWP_IL2CPP 2017.3.0f3 152933480 12/18/2017 8:07:10 AM https://download.unity3d.com/download_unity/...
# Android 2017.3.0f3 194240888 12/18/2017 8:05:58 AM https://download.unity3d.com/download_unity/...
# iOS 2017.3.0f3 802853872 12/18/2017 8:06:46 AM https://download.unity3d.com/download_unity/...
# AppleTV 2017.3.0f3 273433528 12/18/2017 8:06:09 AM https://download.unity3d.com/download_unity/...
# Facebook 2017.3.0f3 32131560 12/18/2017 8:06:12 AM https://download.unity3d.com/download_unity/...
# Vuforia 2017.3.0f3 65677296 12/18/2017 8:07:12 AM https://download.unity3d.com/download_unity/...
# WebGL 2017.3.0f3 134133288 12/18/2017 8:07:19 AM https://download.unity3d.com/download_unity/...
```

Limit what components you search for:
```powershell
Find-UnitySetupInstaller -Version 2017.3.0f3 -Components 'Setup','Documentation' | Format-Table
Find-UnitySetupInstaller -Version 2017.3.0f3 -Components 'Windows','Documentation' | Format-Table

# Example output:
# ComponentType Version Length LastModified DownloadUrl
# ------------- ------- ------ ------------ -----------
# Setup 2017.3.0f3 553688024 2017-12-18 08:15:20 https://netstorage.unity3d.com/unity/...
# Documentation 2017.3.0f3 358911256 2017-12-18 08:18:37 https://netstorage.unity3d.com/unity/...
# ComponentType Version Length LastModified DownloadUrl
# ------------- ------- ------ ------------ -----------
# Windows 2017.3.0f3 553688024 12/18/2017 8:05:31 AM https://download.unity3d.com/download_unity/...
# Documentation 2017.3.0f3 358911256 12/18/2017 8:07:34 AM https://download.unity3d.com/download_unity/...
```

Install UnitySetup instances:
Expand All @@ -114,6 +115,28 @@ Find-UnitySetupInstaller -Version '2017.3.0f3' | Install-UnitySetupInstance
Install-UnitySetupInstance -Installers (Find-UnitySetupInstaller -Version '2017.3.0f3')
```

Manage Unity licenses.
```powershell
# Get any active licenses
Get-UnityLicense

# Example Output:
# LicenseVersion : 6.x
# Serial : System.Security.SecureString
# UnityVersion : 2017.4.2f2
# DisplaySerial : AB-CDEF-GHIJ-KLMN-OPQR-XXXX
# ActivationDate : 2017-07-13 16:32:16
# StartDate : 2017-07-12 00:00:00
# StopDate : 2019-01-01 00:00:00
# UpdateDate : 2018-05-11 23:47:10

# Activate a license
Start-UnityEditor -Credential <unityAccount> -Serial <unitySerial> -Wait

# Return license
Start-UnityEditor -Credential <unityAccount> -ReturnLicense -Wait
```

### DSC
UnitySetup includes the xUnitySetupInstance DSC Resource. An example configuration might look like:

Expand All @@ -122,15 +145,28 @@ UnitySetup includes the xUnitySetupInstance DSC Resource. An example configurati
Install multiple versions of Unity and several components
#>
Configuration Sample_xUnitySetupInstance_Install {
param(
[PSCredential]$UnityCredential,
[PSCredential]$UnitySerial
)

Import-DscResource -ModuleName UnitySetup

Node 'localhost' {

xUnitySetupInstance Unity {
Versions = '2017.3.1f1,2018.1.0b9'
Components = 'Setup', 'Mac', 'Linux', 'Metro', 'iOS'
Versions = '2017.4.2f2,2018.1.0f2'
Components = 'Windows', 'Mac', 'Linux', 'Metro', 'iOS'
Ensure = 'Present'
}

xUnityLicense UnityLicense {
Name = 'UL01'
Credential = $UnityCredential
Serial = $UnitySerial
Ensure = 'Present'
UnityVersion = '2017.4.2f2'
DependsOn = '[xUnitySetupInstance]Unity'
}
}
}
Expand All @@ -148,4 +184,8 @@ This project welcomes contributions and suggestions. Most contributions require

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

# Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at [secure@microsoft.com](mailto:secure@microsoft.com). You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the [MSRC PGP](https://technet.microsoft.com/en-us/security/dn606155) key, can be found in the [Security TechCenter](https://technet.microsoft.com/en-us/security/default).
109 changes: 109 additions & 0 deletions UnitySetup/DSCResources/xUnityLicense/xUnityLicense.psm1
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
function Get-TargetResource {
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
(
[parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$Credential,

[parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$Serial,

[parameter(Mandatory = $false)]
[System.String]
$UnityVersion,

[parameter(Mandatory = $true)]
[System.String]
$Name
)

@{ 'Licenses' = (Get-UnityLicense) }
}


function Set-TargetResource {
[CmdletBinding()]
param
(
[parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$Credential,

[ValidateSet("Present", "Absent")]
[System.String]
$Ensure = 'Present',

[parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$Serial,

[System.String]
$UnityVersion,

[parameter(Mandatory = $true)]
[System.String]
$Name
)

if ( Test-TargetResource @PSBoundParameters ) { return }

$unityArgs = @{
'Credential' = $Credential
'Wait' = $true
}

if ( $UnityVersion ) { $unityArgs['Version'] = $UnityVersion }
if ( $Ensure -eq 'Present' ) { $unityArgs['Serial'] = $Serial.Password }
else { $unityArgs['ReturnLicense'] = $true }

Start-UnityEditor @unityArgs -Verbose
}


function Test-TargetResource {
[CmdletBinding()]
[OutputType([System.Boolean])]
param
(
[parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$Credential,

[ValidateSet("Present", "Absent")]
[System.String]
$Ensure = 'Present',

[parameter(Mandatory = $true)]
[System.Management.Automation.PSCredential]
$Serial,

[parameter(Mandatory = $false)]
[System.String]
$UnityVersion,

[parameter(Mandatory = $true)]
[System.String]
$Name
)

foreach ( $license in (Get-UnityLicense -Serial $Serial.Password) ) {
Write-Verbose "Found license: $license"

$currentSerial = [System.Net.NetworkCredential]::new($null, $license.Serial).Password
$passedSerial = $Serial.GetNetworkCredential().Password
if ( $currentSerial -ne $passedSerial ) { continue }

return $Ensure -eq 'Present'
}

return $Ensure -eq 'Absent'
}


Export-ModuleMember -Function *-TargetResource

11 changes: 11 additions & 0 deletions UnitySetup/DSCResources/xUnityLicense/xUnityLicense.schema.mof
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@

[ClassVersion("1.0.0.0"), FriendlyName("xUnityLicense")]
class xUnityLicense : OMI_BaseResource
{
[Key] string Name;
[Required, EmbeddedInstance("MSFT_Credential")] String Credential;
[Required, EmbeddedInstance("MSFT_Credential")] String Serial;
[Write, ValueMap{"Present","Absent"}, Values{"Present","Absent"}] string Ensure;
[Write] string UnityVersion;
};

Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@

# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.
<#
.Synopsis
Returns the status of Unity installs and the set of their overlapping components.
Expand Down
44 changes: 44 additions & 0 deletions UnitySetup/Examples/Sample_xUnity.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<#
Create a custom configuration by passing in necessary values
#>
Configuration Sample_xUnity {
param
(
[System.String]
$Version = '2017.4.2f2',

[ValidateSet('Present', 'Absent')]
[System.String]
$Ensure = 'Present',

[System.String[]]
$Components = @('Windows', 'Mac', 'Linux', 'Metro', 'iOS', 'Android'),

[PSCredential]
$UnityCredential,

[PSCredential]
$UnitySerial
)

Import-DscResource -ModuleName UnitySetup

Node 'localhost' {

xUnitySetupInstance Unity {
Versions = $Version
Components = $Components
Ensure = $Ensure
DependsOn = if( $Ensure -eq 'Absent' ) { '[xUnityLicense]UnityLicense' } else { $null }
}

xUnityLicense UnityLicense {
Name = 'UL01'
Credential = $UnityCredential
Serial = $UnitySerial
Ensure = $Ensure
UnityVersion = $Version
DependsOn = if( $Ensure -eq 'Present' ) { '[xUnitySetupInstance]Unity' } else { $null }
}
}
}
28 changes: 0 additions & 28 deletions UnitySetup/Examples/Sample_xUnitySetupInstance.ps1

This file was deleted.

16 changes: 0 additions & 16 deletions UnitySetup/Examples/Sample_xUnitySetupInstance_Install.ps1

This file was deleted.

15 changes: 0 additions & 15 deletions UnitySetup/Examples/Sample_xUnitySetupInstance_Uninstall.ps1

This file was deleted.

Loading