├── Configurations
├── Disable-Drive-Mount-Sounds
│ ├── Importing different types of jsons in ProfileUnity.pdf
│ ├── ModuleItems-Reg-DriveSoundDisable.json
│ └── README.md
├── Importing different types of jsons in ProfileUnity.pdf
└── OST Redirection to VHD
│ ├── ModuleItems-Outlook OST Caching.zip
│ └── README.md
├── PowerTools
├── PowerTools Core
│ ├── Command List.txt
│ ├── ProUPowerTools.v1.4.psm1
│ ├── ProUPowertoolsV2.0.B6.psm1
│ ├── ProUPowertoolsV2.0.B7.psm1
│ └── ReadMe.MD
├── Printer Creation from Template
│ ├── Printer Add.zip
│ └── ReadMe.MD
├── ProfileUnity Backup
│ ├── BackupDBv4.zip
│ ├── ReadMe.MD
│ ├── Retired - Backup DBv1.zip
│ └── Retired - BackupDBv3.zip
├── ProfileUnity Filter Creation from Template
│ ├── Creating a Filter.pdf
│ ├── ProfileUnity Filter Creation from Templatev2.zip
│ ├── ProfileUnity Filter Creation from Templatev4.zip
│ └── ReadMe.MD
└── ProfileUnity Restore From Retention
│ ├── ReadMe.MD
│ └── restoreRetentionv4.ps1
├── SE Field Articles
├── BootEnvVar.pdf
├── Local profileUnity Install.pdf
├── ProfileUnity 2012 GPO Creation.pdf
└── readme.md
├── Scripts
├── Clean Uninstall-Reinstall
│ ├── README.md
│ └── uninstallClient-reinstall.ps1
├── Create Local GPO
│ ├── LocalGPOv2.zip
│ └── README.md
├── Modern App Selection
│ ├── Fix-Start.reg
│ ├── Fix-Start.reg.txt
│ ├── ProcessAppX.ps1
│ └── ReadMe.MD
├── ProfileUnityClientTools_686R1_SilentInstall.ps1
├── ProfileUnityClientTools_SettingsOnly.ps1.ps1
├── ProfileUnityConsole_SilentInstall.ps1
└── Share Creation
│ ├── README.md
│ └── ShareCreationScript.bat
└── readme.md
/Configurations/Disable-Drive-Mount-Sounds/Importing different types of jsons in ProfileUnity.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/Configurations/Disable-Drive-Mount-Sounds/Importing different types of jsons in ProfileUnity.pdf
--------------------------------------------------------------------------------
/Configurations/Disable-Drive-Mount-Sounds/ModuleItems-Reg-DriveSoundDisable.json:
--------------------------------------------------------------------------------
1 | {
2 | "AdministrativeTemplates": [],
3 | "ApplicationLaunchers": [],
4 | "ApplicationRestrictions": [],
5 | "Comments": "",
6 | "CompressionType": 2,
7 | "DesktopStartMenus": [],
8 | "DisableGroupTokenCache": true,
9 | "DriveMappings": [],
10 | "EnableFilter": false,
11 | "EnableLogFilter": false,
12 | "EnvironmentVariables": [],
13 | "FileAssociations": [],
14 | "Filter": null,
15 | "FilterId": "",
16 | "FlexAppDias": [],
17 | "FlexAppUias": [],
18 | "FolderRedirections": [],
19 | "GroupName": "",
20 | "IniFiles": [],
21 | "InternetExplorers": [],
22 | "InternetProxies": [],
23 | "Inventories": [],
24 | "LegacyMode": false,
25 | "LogFilter": null,
26 | "LogFilterId": "",
27 | "LogLevel": 1,
28 | "LogPath": "",
29 | "MapiProfiles": [],
30 | "MessageBoxes": [],
31 | "Name": "Windows 7, Win 10 v3",
32 | "Notes": "Using Global VAR",
33 | "OfficeFileLocations": [],
34 | "OfficeOptions": [],
35 | "Outlooks": [],
36 | "Paths": [],
37 | "PortabilityRetention": 0,
38 | "PortabilitySettings": [],
39 | "Printers": [],
40 | "PrivilegeElevations": [],
41 | "ProfileCleanups": [],
42 | "RdpClients": [],
43 | "Registries": [
44 | {
45 | "Action": 2,
46 | "Data": "",
47 | "DataType": 0,
48 | "Hive": 4,
49 | "Key": "AppEvents\\Schemes\\Apps\\.Default\\DeviceDisconnect\\.Current",
50 | "ProcessActionPostLogin": false,
51 | "Value": "",
52 | "Filter": null,
53 | "FilterId": null,
54 | "Description": "Turn off Drive Disconnect sound",
55 | "Disabled": false,
56 | "Sequence": 15
57 | },
58 | {
59 | "Action": 0,
60 | "Data": "",
61 | "DataType": 4,
62 | "Hive": 4,
63 | "Key": "AppEvents\\Schemes\\Apps\\.Default\\DeviceDisconnect\\.Current",
64 | "ProcessActionPostLogin": false,
65 | "Value": "",
66 | "Filter": null,
67 | "FilterId": null,
68 | "Description": "Turn off Drive Disconnect sound",
69 | "Disabled": false,
70 | "Sequence": 16
71 | },
72 | {
73 | "Action": 2,
74 | "Data": "",
75 | "DataType": 0,
76 | "Hive": 4,
77 | "Key": "AppEvents\\Schemes\\Apps\\.Default\\DeviceConnect\\.Current",
78 | "ProcessActionPostLogin": false,
79 | "Value": "",
80 | "Filter": null,
81 | "FilterId": null,
82 | "Description": "Turn off Drive connect sound",
83 | "Disabled": false,
84 | "Sequence": 17
85 | },
86 | {
87 | "Action": 0,
88 | "Data": "",
89 | "DataType": 4,
90 | "Hive": 4,
91 | "Key": "AppEvents\\Schemes\\Apps\\.Default\\DeviceConnect\\.Current",
92 | "ProcessActionPostLogin": false,
93 | "Value": "",
94 | "Filter": null,
95 | "FilterId": null,
96 | "Description": "Turn off Drive connect sound",
97 | "Disabled": false,
98 | "Sequence": 18
99 | }
100 | ],
101 | "RequireGroupMembership": false,
102 | "Shortcuts": [],
103 | "ThinApps": [],
104 | "TimeSyncs": [],
105 | "TriggerPoints": [],
106 | "UserDefinedAliases": [],
107 | "UserDefinedScripts": [],
108 | "VirtualDisks": [],
109 | "WindowsOptions": [],
110 | "CreatedBy": "administrator",
111 | "DateCreated": "/Date(1465582930000)/",
112 | "DateLastModified": "/Date(1470696654914)/",
113 | "Disabled": false,
114 | "Id": "575b055208845e0608e52ef0",
115 | "LastModifiedBy": "administrator",
116 | "Version": "6.5.6037 2572c5a"
117 | }
--------------------------------------------------------------------------------
/Configurations/Disable-Drive-Mount-Sounds/README.md:
--------------------------------------------------------------------------------
1 | # ProfileUnity-Disable-Drive-Mount-Sounds
2 |
3 | Description
4 | ProfileUnity Configurations and Regkeys for Disabling Disk Mount Sounds in Windows
5 |
6 | Attached in this repository is:
7 | ModuleItems-Reg-DriveSoundDisable.json(disable Mount Sounds)
8 |
9 | How to Use
10 | Import into ProfileUnity
11 | Documents attached: Importing different types of jsons in ProfileUnity.pdf
12 |
13 |
14 | | OS Version | Verified |
15 | | ------------- | ------------- |
16 | |Windows 10 | YES |
17 | |Windows Server 2012 | YES |
18 | |Windows Server 2012 R2 | YES |
19 | |Windows Server 2008 R2 | YES |
20 | |Windows Server 2008 | YES |
21 | |Windows Server 2003 | No |
22 | |Windows 8 | YES |
23 | |Windows 7 | YES |
24 | |Windows Vista | No |
25 | |Windows XP | No |
26 | |Windows 2000 | No |
27 |
--------------------------------------------------------------------------------
/Configurations/Importing different types of jsons in ProfileUnity.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/Configurations/Importing different types of jsons in ProfileUnity.pdf
--------------------------------------------------------------------------------
/Configurations/OST Redirection to VHD/ModuleItems-Outlook OST Caching.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/Configurations/OST Redirection to VHD/ModuleItems-Outlook OST Caching.zip
--------------------------------------------------------------------------------
/Configurations/OST Redirection to VHD/README.md:
--------------------------------------------------------------------------------
1 | # ProfileUnity-OST-VHD-Configurations
2 |
3 | Description
4 | ProfileUnity Configurations for OST redirection into a mounted VHD
5 |
6 | Attached in this repository is:
7 | ModuleItems-Outlook OST Caching.json (Virtual Disk Config and Userdefined Settings for OUTLOOK redirection)
8 |
9 | How to Use
10 | Documents attached: Importing different types of jsons in ProfileUnity.pdf
11 |
12 |
13 | | OS Version | Verified |
14 | | ------------- | ------------- |
15 | |Windows 10 | YES |
16 | |Windows Server 2012 | YES |
17 | |Windows Server 2012 R2 | YES |
18 | |Windows Server 2008 R2 | YES |
19 | |Windows Server 2008 | YES |
20 | |Windows Server 2003 | No |
21 | |Windows 8 | YES |
22 | |Windows 7 | YES |
23 | |Windows Vista | No |
24 | |Windows XP | No |
25 | |Windows 2000 | No |
26 |
--------------------------------------------------------------------------------
/PowerTools/PowerTools Core/Command List.txt:
--------------------------------------------------------------------------------
1 | ProfileUnity Powershell Commands v1
2 |
3 | connect-ProfileUnityServer
4 | Type in command and follow the prompts
5 |
6 | get-ProUconfigs
7 | Type in command get responce
8 |
9 | get-ProUFilters
10 | Type in command get responce
11 |
12 | get-ProUFlexapps
13 | Type in command get responce
14 |
15 | get-ProUPortRules
16 | Type in command get responce
17 |
18 | load-proUconfig([string]$name)
19 | Example: load-proUconfig -name "configuration name"
20 | to see configuration type $CurrentConfig
21 |
22 | load-proUPortRule([string]$name)
23 | Example: load-proUPortRule -name "Port Rule Name"
24 | to see configuration type $CurrentPortRule
25 |
26 | load-proUfilter([string]$name)
27 | Example: load-proUfilter -name "Filter Name"
28 | to see configuration type $Currentfilter
29 |
30 | Save-ProUConfig
31 | Type in command get responce
32 |
33 | Save-ProUPortRule
34 | Type in command get responce
35 |
36 | Save-ProUFilter
37 | Type in command get responce
38 |
39 | export-proUconfig([string]$name, $savepath)
40 | Example: export-proUconfig -name "configuration name" -savepath "c:\Path\"
41 | The backslash at the end of the path is important
42 |
43 | Export-ProUConfigAll ($savepath)
44 | Example: Export-ProUConfigAll -savepath "c:\Path\"
45 | The backslash at the end of the path is important
46 |
47 | Import-ProuConfig
48 | Type in command and follow the prompts
49 |
50 | Import-ProuConfigAll ($source)
51 | Example: Import-ProuConfigAll -source "c:\Path\"
52 | The backslash at the end of the path is important
--------------------------------------------------------------------------------
/PowerTools/PowerTools Core/ProUPowerTools.v1.4.psm1:
--------------------------------------------------------------------------------
1 | <#
2 | .DISCLAIMER
3 | This script is provided "AS IS" with no warranties, confers no rights, and is not supported by Liquidware Labs.
4 |
5 | .SYNOPSIS
6 | ProfileUnity Powershell Commands and Functions
7 |
8 | .DESCRIPTION
9 | Made for ProfileUnity Command line modifications to configurations, Filters, and Portability Rules
10 |
11 | .NOTES
12 | NAME: ProUPowerTools.v1.psm1
13 | AUTHOR: Jack Smith
14 | Email Address: Jack.Smith@liquidwarelabs.com
15 | Twitter: @MrSmithLWL
16 | Github: https://github.com/liquidwarelabs
17 | LASTEDIT: 1/8/2020
18 | KEYWORDS: ProfileUnity, Powershell, Flexapp, Json
19 | Notes: v1.2 Fixed Save Functions
20 | v1.4 Fixed Config export and import functions
21 |
22 | #>
23 |
24 | ##login Function
25 |
26 | function connect-ProfileUnityServer{
27 | ##Ignore-SSL Library Code
28 | add-type @"
29 | using System.Net;
30 | using System.Security.Cryptography.X509Certificates;
31 | public class TrustAllCertsPolicy : ICertificatePolicy {
32 | public bool CheckValidationResult(
33 | ServicePoint srvPoint, X509Certificate certificate,
34 | WebRequest request, int certificateProblem) {
35 | return true;
36 | }
37 | }
38 | "@
39 | [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
40 |
41 | ##Get Creds
42 | [string]$global:servername= Read-Host -Prompt 'FQDN of ProfileUnity Server Name'
43 | $user = Read-Host "Enter Username"
44 | $pass = Read-Host -assecurestring "Enter Password"
45 | $pass2=[Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass))
46 |
47 | #Connect to Server
48 | Invoke-WebRequest https://"$servername":8000/authenticate -Body "username=$user&password=$pass2" -Method Post -SessionVariable session
49 | $global:session=$session
50 | }
51 |
52 | ## Get Functions ##
53 |
54 | ## Get Configurations
55 | function get-ProUconfigs
56 | {
57 | $PUGC = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
58 | $PUGC.Tag.Rows
59 | }
60 |
61 | ## Get Filters
62 | function get-ProUFilters
63 | {
64 | $PUGF = ((Invoke-WebRequest https://"$servername":8000/api/filter -WebSession $session).Content) | ConvertFrom-Json
65 | $PUGF.Tag.Rows
66 | }
67 |
68 | ## Get FlexApps
69 | function get-ProUFlexapps
70 | {
71 | $PUFA = ((Invoke-WebRequest https://"$servername":8000/api/flexapppackage/vhd? -WebSession $session).Content) | ConvertFrom-Json
72 | $PUFA.TAG.ROWS
73 | }
74 |
75 | ## Get Portability Rules
76 | function get-ProUPortRules
77 | {
78 | $PUFP = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
79 | $PUFP.TAG.ROWS
80 | }
81 |
82 |
83 |
84 | ## Load Functions ##
85 |
86 | ## Load ProfileUnity Configurations
87 | function load-proUconfig([string]$name)
88 | {
89 | $PUGC = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
90 | [string]$configID=$PUGC.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
91 | $configR= ((Invoke-WebRequest https://"$servername":8000/api/configuration/"$configID" -WebSession $session).Content) | ConvertFrom-Json
92 | $config=$configR.tag
93 | $global:CurrentConfig = $config
94 | }
95 |
96 |
97 | ## Load Portability Rule Set
98 | function load-proUPortRule([string]$name)
99 | {
100 | $PUGP = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
101 | [string]$configID=$PUGP.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
102 | $configR= ((Invoke-WebRequest https://"$servername":8000/api/portability/"$configID" -WebSession $session).Content) | ConvertFrom-Json
103 | $config=$configR.tag
104 | $global:CurrentPortRule = $config
105 | }
106 |
107 |
108 | ## Load ProfileUnity Filter
109 | function load-proUfilter([string]$name)
110 | {
111 | $PUGF = ((Invoke-WebRequest https://"$servername":8000/api/filter -WebSession $session).Content) | ConvertFrom-Json
112 | [string]$configID=$PUGF.Tag.Rows | Where-Object {$_.name -EQ $name} | foreach-object {$_.id}
113 | $configR= ((Invoke-WebRequest https://"$servername":8000/api/filter/"$configID" -WebSession $session).Content) | ConvertFrom-Json
114 | $config=$configR.tag
115 | $global:Currentfilter = $config
116 | }
117 |
118 |
119 | ## Save Functions ##
120 |
121 | ##Prompt-Choice Function Library code
122 | function Prompt-Choice {
123 | #param (
124 | # [parameter(mandatory=$true)][string]$Title,
125 | # [parameter(mandatory=$true)][string]$Message
126 | #)
127 |
128 | $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes."
129 | $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No."
130 | $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
131 | $result = $host.ui.PromptForChoice($title, $message, $options, 0)
132 | switch ($result)
133 | {
134 | 0 { $true }
135 | 1 { $false }
136 | }
137 | }
138 |
139 | ##Save Configuration settings##
140 | Function Save-ProUConfig{
141 | $answer=prompt-choice
142 | if ($answer -eq $False)
143 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
144 | else
145 | {
146 | Invoke-WebRequest https://"$servername":8000/api/configuration -ContentType "application/json" -Method Post -WebSession $session -Body($Currentconfig | ConvertTo-Json -Depth 10)
147 | }
148 | }
149 |
150 | ##Save Portability Rule settings##
151 | Function Save-ProUPortRule{
152 | $answer=prompt-choice
153 | if ($answer -eq $False)
154 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
155 | else
156 | {
157 | Invoke-WebRequest https://"$servername":8000/api/portability -ContentType "application/json" -Method Post -WebSession $session -Body($CurrentPortRule | ConvertTo-Json -Depth 10)
158 | }
159 | }
160 |
161 | ##Save Filter settings##
162 | Function Save-ProUFilter{
163 | $answer=prompt-choice
164 | if ($answer -eq $False)
165 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
166 | else
167 | {
168 | Invoke-WebRequest https://"$servername":8000/api/filter -ContentType "application/json" -Method Post -WebSession $session -Body($Currentfilter | ConvertTo-Json -Depth 10)
169 | }
170 | }
171 |
172 |
173 | ## Export Configuration Json ##
174 |
175 | ## Export Single Configuration Json
176 | function export-proUconfig([string]$name, $savepath)
177 | {
178 | if (!$savepath)
179 | {
180 | Write-host -ForegroundColor red "Missing Save Path"
181 | }
182 | else
183 | {
184 | #Load Config into memory
185 | $PUGC = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
186 | [string]$configID=$PUGC.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
187 | #Export Config
188 | $ProgressPreference = 'SilentlyContinue'
189 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/configuration/"$configID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
190 | }
191 | }
192 |
193 | ## Export All Configurations Jsons
194 | Function Export-ProUConfigAll ($savepath)
195 | {
196 | if (!$savepath)
197 | {
198 | Write-host -ForegroundColor red "Missing Save Path"
199 | }
200 | else
201 | {
202 | #get List
203 | $configlist=get-prouconfigs
204 | [array]$configlist=$configlist.name
205 | #export out all
206 | foreach ($name in $configlist)
207 | {
208 | #Load Configs into memory
209 | $PUGC = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
210 | [string]$configID=$PUGC.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
211 |
212 | #Export Config
213 | #Invoke-WebRequest https://"$servername":8000/api/configuration/"$configID" -WebSession $session -OutFile "$savepath$name.json" -PassThru
214 | $ProgressPreference = 'SilentlyContinue'
215 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/configuration/"$configID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
216 | }
217 | }
218 | }
219 |
220 | ## Import Configuration Json ##
221 |
222 | ## Import Single Configuration Json
223 | Function Import-ProuConfig{
224 |
225 | #get file path
226 | Function Get-FileName($jsonfile)
227 | {
228 | [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
229 | Out-Null
230 |
231 | $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
232 | $OpenFileDialog.initialDirectory = $initialDirectory
233 | $OpenFileDialog.filter = "All files (*.json*)| *.json*"
234 | $OpenFileDialog.ShowDialog() | Out-Null
235 | $OpenFileDialog.filename
236 | } #end function Get-FileName
237 |
238 | #Import Json
239 | $jsonfile=Get-FileName
240 | $jsonimport=Get-Content $jsonFile | ConvertFrom-Json
241 |
242 | #Change Name and ID
243 | $connectionString = $jsonimport | select-object -expand configurations
244 | $connectionString.name = $jsonimport.Configurations.name + " - Imported"
245 | $connectionString.ID = $Null
246 |
247 |
248 | #Save Json
249 | Invoke-WebRequest https://"$servername":8000/api/configuration -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.configurations | ConvertTo-Json -Depth 10)
250 |
251 | }
252 |
253 | #Get ProU Redirtection #
254 | function get-ProUredirection {
255 | $PUGinvred = ((Invoke-WebRequest https://"$servername":8000/api/collector/redirection -WebSession $session).Content) | ConvertFrom-Json
256 | $PUGinvred.Tag.rows
257 | }
258 |
259 | ## Import All Configuration Jsons
260 | Function Import-ProuConfigAll ($source)
261 | {
262 | if (!$source)
263 | {
264 | Write-host -ForegroundColor red "Missing Source Path"
265 | }
266 | else
267 | {
268 |
269 | $lists=Get-ChildItem $source
270 | $lists=$lists.VersionInfo.filename
271 | foreach ($json in $lists)
272 |
273 | {
274 |
275 | #Import Json
276 | $jsonfile=$json
277 | $jsonimport = Get-Content $jsonFile | ConvertFrom-Json
278 |
279 | #Change Name and ID
280 | $connectionString = $jsonimport | Select-Object -expand configurations
281 | $connectionString.name = $jsonimport.Configurations.name + " - Imported"
282 | $connectionString.ID = $Null
283 |
284 |
285 | #Save Json
286 | Invoke-WebRequest https://"$servername":8000/api/configuration -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.configurations | ConvertTo-Json -Depth 10)
287 |
288 | }
289 | }
290 | }
291 |
292 | ## End Of Code, Have a Wonderful Day ##
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
--------------------------------------------------------------------------------
/PowerTools/PowerTools Core/ProUPowertoolsV2.0.B6.psm1:
--------------------------------------------------------------------------------
1 | <#
2 | .DISCLAIMER
3 | This script is provided "AS IS" with no warranties, confers no rights, and is not supported by Liquidware Labs.
4 |
5 | .SYNOPSIS
6 | ProfileUnity Powershell Commands and Functions
7 |
8 | .DESCRIPTION
9 | Made for ProfileUnity Command line modifications to configurations, Filters, and Portability Rules
10 | .NOTES
11 | NAME: ProUPowerTools2.0.B4.psm1
12 | AUTHOR: Jack Smith
13 | Email Address: Jack.Smith@liquidware.com
14 | X: @MrSmithLWL
15 | Github: https://github.com/liquidwarelabs
16 | LASTEdit: 04/10/2024
17 | KEYWORDS: ProfileUnity, Powershell, Flexapp, Json
18 | Notes: v2.0B4
19 | Updates Added Case consistency to all functions
20 | Changes Deploy verb to Update verb (Update-ProUConfig)
21 | v2.0B5 added no status for speed increase
22 | Added in load for edit screen
23 | Added Silent Switched for load for edit.
24 | #>
25 |
26 | ## Supporting Core Functions ##
27 |
28 | ##Speed up Powershell Process show no progress##
29 | $ProgressPreference = 'SilentlyContinue'
30 |
31 |
32 | ##Prompt-Choice Function Library code
33 | function Prompt-Choice {
34 | #param (
35 | # [parameter(mandatory=$true)][string]$Title,
36 | # [parameter(mandatory=$true)][string]$Message
37 | #)
38 |
39 | $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes."
40 | $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No."
41 | $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
42 | $result = $host.ui.PromptForChoice($title, $message, $options, 0)
43 | switch ($result)
44 | {
45 | 0 { $true }
46 | 1 { $false }
47 | }
48 | }
49 |
50 |
51 | ## Get file path ##
52 | Function Get-FileName($jsonfile)
53 | {
54 | [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
55 | Out-Null
56 |
57 | $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
58 | $OpenFileDialog.initialDirectory = $initialDirectory
59 | $OpenFileDialog.filter = "All files (*.json*)| *.json*"
60 | $OpenFileDialog.ShowDialog() | Out-Null
61 | $OpenFileDialog.filename
62 | } #end function Get-FileName
63 |
64 |
65 | ##login Functions Cert exceptions##
66 |
67 | function connect-ProfileUnityServer{
68 |
69 | ########################################
70 | # Adding certificate exception to prevent API errors
71 | ########################################
72 | add-type @"
73 | using System.Net;
74 | using System.Security.Cryptography.X509Certificates;
75 | public class TrustAllCertsPolicy : ICertificatePolicy {
76 | public bool CheckValidationResult(
77 | ServicePoint srvPoint, X509Certificate certificate,
78 | WebRequest request, int certificateProblem) {
79 | return true;
80 | }
81 | }
82 | "@
83 | [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
84 | #optional security bypass
85 | #[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]'Ssl3,Tls,Tls11,Tls12'
86 |
87 |
88 | ##Prof
89 | [string]$global:servername= Read-Host -Prompt 'FQDN of ProfileUnity Server Name'
90 | $user = Read-Host "Enter Username"
91 | $pass = Read-Host -assecurestring "Enter Password"
92 | $pass2=[Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass))
93 |
94 | #Connect to Server
95 | Invoke-WebRequest https://"$servername":8000/authenticate -Body "username=$user&password=$pass2" -Method Post -SessionVariable session
96 | $global:session=$session
97 | }
98 |
99 |
100 | ## Filter Functions (api/filter)
101 |
102 | ## Get Filter ##
103 | function Get-ProUFilters
104 | {
105 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/Filter -WebSession $session).Content) | ConvertFrom-Json
106 | $PUG.Tag.Rows
107 | }
108 |
109 | ## Load ProfileUnity Filters ##
110 | function Edit-ProUFilter([string]$name, $quiet)
111 | {
112 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/Filter -WebSession $session).Content) | ConvertFrom-Json
113 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
114 | $configR= ((Invoke-WebRequest https://"$servername":8000/api/Filter/"$ID" -WebSession $session).Content) | ConvertFrom-Json
115 | $config=$configR.tag
116 | $global:CurrentFilter = $config
117 | if ($quiet -eq $False){
118 | write-host "$name loaded for editing"
119 | }
120 | }
121 |
122 | ## Save Filter settings ##
123 | Function Save-ProUFilter{
124 | $answer=prompt-choice
125 | if ($answer -eq $False)
126 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
127 | else
128 | {
129 | Invoke-WebRequest https://"$servername":8000/api/Filter -ContentType "application/json" -Method Post -WebSession $session -Body($CurrentFilter | ConvertTo-Json -Depth 10)
130 | }
131 | }
132 |
133 |
134 | ## Delete Filter ##
135 | function Remove-ProUFilter([string]$name)
136 | {
137 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/filter -WebSession $session).Content) | ConvertFrom-Json
138 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -EQ $name} | ForEach-Object {$_.id}
139 | $response = Invoke-WebRequest https://"$servername":8000/api/Filter"$ID"?force=false -Method Delete -WebSession $session
140 | $Message=$response.Content | ConvertFrom-Json
141 | write-host $message.message
142 | }
143 |
144 |
145 | ## Export Single Filter Json
146 | function Export-ProUFilter([string]$name, $savepath)
147 | {
148 | if (!$savepath)
149 | {
150 | Write-host -ForegroundColor red "Missing Save Path"
151 | }
152 | else
153 | {
154 | #Load Filter into memory
155 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/Filter -WebSession $session).Content) | ConvertFrom-Json
156 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
157 | #Export Filter
158 | $ProgressPreference = 'SilentlyContinue'
159 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/Filter/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
160 | }
161 | }
162 |
163 | ## Export All Filters Jsons ##
164 | Function Export-ProUFilterAll ($savepath)
165 | {
166 | if (!$savepath)
167 | {
168 | Write-host -ForegroundColor red "Missing Save Path"
169 | }
170 | else
171 | {
172 | #Get List
173 | $list=Get-ProUFilters
174 | [array]$list=$list.name
175 | #Export out all
176 | foreach ($name in $list)
177 | {
178 | #Load Configs into memory
179 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/Filter -WebSession $session).Content) | ConvertFrom-Json
180 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
181 |
182 | #Export Items
183 | #Invoke-WebRequest https://"$servername":8000/api/Filter/"$ID" -WebSession $session -OutFile "$savepath$name.json" -PassThru
184 | $ProgressPreference = 'SilentlyContinue'
185 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/Filter/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
186 | }
187 | }
188 | }
189 |
190 | ## Import Filter Json ##
191 |
192 | ## Import Single Filter Json
193 | Function Import-ProUFilter{
194 |
195 | #Import Json
196 | $jsonfile=Get-FileName
197 | $jsonimport=Get-Content $jsonFile | ConvertFrom-Json
198 |
199 | #Change Name and ID
200 | $connectionString = $jsonimport | select-object -expand Filters
201 | $connectionString.name = $jsonimport.Filters.name + " - Imported"
202 | $connectionString.ID = $Null
203 |
204 |
205 | #Save Json
206 | Invoke-WebRequest https://"$servername":8000/api/Filter -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.Filters | ConvertTo-Json -Depth 10)
207 |
208 | }
209 |
210 |
211 | ## Import All Filter Jsons ##
212 | Function Import-ProUFilterAll ($sourceDir)
213 | {
214 | if (!$sourcedir)
215 | {
216 | Write-host -ForegroundColor red "Missing Source Path Dir"
217 | }
218 | else
219 | {
220 |
221 | $lists=Get-ChildItem $sourcedir
222 | $lists=$lists.VersionInfo.filename
223 | foreach ($json in $lists)
224 |
225 | {
226 |
227 | #Import Json
228 | $jsonfile=$json
229 | $jsonimport = Get-Content $jsonFile | ConvertFrom-Json
230 |
231 | #Change Name and ID
232 | $connectionString = $jsonimport | Select-Object -expand Filters
233 | $connectionString.name = $jsonimport.Filters.name + " - Imported"
234 | $connectionString.ID = $Null
235 |
236 |
237 | #Save Json
238 | Invoke-WebRequest https://"$servername":8000/api/Filter -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.Filters | ConvertTo-Json -Depth 10)
239 |
240 | }
241 | }
242 | }
243 |
244 | ## Portability Functions (api/portability) ##
245 |
246 | ## Get PortRule ##
247 | function Get-ProUPortRule
248 | {
249 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
250 | $PUG.Tag.Rows
251 | }
252 |
253 | ## Load ProfileUnity PortRules ##
254 | function Edit-ProUPortRule([string]$name, $quiet)
255 | {
256 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
257 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
258 | $configR= ((Invoke-WebRequest https://"$servername":8000/api/portability/"$ID" -WebSession $session).Content) | ConvertFrom-Json
259 | $config=$configR.tag
260 | $global:CurrentPortRule= $config
261 | if ($quiet -eq $False){
262 | write-host "$name loaded for editing"
263 | }
264 | }
265 |
266 | ## Save PortRule settings ##
267 | Function Save-ProUPortRule{
268 | $answer=prompt-choice
269 | if ($answer -eq $False)
270 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
271 | else
272 | {
273 | Invoke-WebRequest https://"$servername":8000/api/portability -ContentType "application/json" -Method Post -WebSession $session -Body($CurrentPortRule | ConvertTo-Json -Depth 10)
274 | }
275 | }
276 |
277 |
278 | ## Delete PortRule ##
279 | function Remove-ProUPortRule([string]$name)
280 | {
281 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
282 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -EQ $name} | ForEach-Object {$_.id}
283 | $response = Invoke-WebRequest https://"$servername":8000/api/portability"$ID"?force=false -Method Delete -WebSession $session
284 | $Message=$response.Content | ConvertFrom-Json
285 | write-host $message.message
286 | }
287 |
288 |
289 | ## Export Single PortRule Json
290 | function Export-ProUPortRule([string]$name, $savepath)
291 | {
292 | if (!$savepath)
293 | {
294 | Write-host -ForegroundColor red "Missing Save Path"
295 | }
296 | else
297 | {
298 | #Load PortRule into memory
299 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
300 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
301 | #Export PortRule
302 | $ProgressPreference = 'SilentlyContinue'
303 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/portability/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
304 | }
305 | }
306 |
307 | ## Export All PortRules Jsons ##
308 | Function Export-ProUPortRuleAll ($savepath)
309 | {
310 | if (!$savepath)
311 | {
312 | Write-host -ForegroundColor red "Missing Save Path"
313 | }
314 | else
315 | {
316 | #Get List
317 | $list=Get-ProUPortRules
318 | [array]$list=$list.name
319 | #Export out all
320 | foreach ($name in $list)
321 | {
322 | #Load Configs into memory
323 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
324 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
325 |
326 | #Export Items
327 | #Invoke-WebRequest https://"$servername":8000/api/portability/"$ID" -WebSession $session -OutFile "$savepath$name.json" -PassThru
328 | $ProgressPreference = 'SilentlyContinue'
329 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/portability/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
330 | }
331 | }
332 | }
333 |
334 | ## Import PortRule Json ##
335 |
336 | ## Import Single PortRule Json
337 | Function Import-ProUPortRule{
338 |
339 | #Import Json
340 | $jsonfile=Get-FileName
341 | $jsonimport=Get-Content $jsonFile | ConvertFrom-Json
342 |
343 | #Change Name and ID
344 | $connectionString = $jsonimport | select-object -expand portability
345 | $connectionString.name = $jsonimport.portability.name + " - Imported"
346 | $connectionString.ID = $Null
347 |
348 |
349 | #Save Json
350 | Invoke-WebRequest https://"$servername":8000/api/portability -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.portrules | ConvertTo-Json -Depth 10)
351 |
352 | }
353 |
354 |
355 | ## Import All PortRule Jsons ##
356 | Function Import-ProUPortRuleAll ($sourcedir)
357 | {
358 | if (!$sourcedir)
359 | {
360 | Write-host -ForegroundColor red "Missing Source Path Dir"
361 | }
362 | else
363 | {
364 |
365 | $lists=Get-ChildItem $sourcedir
366 | $lists=$lists.VersionInfo.filename
367 | foreach ($json in $lists)
368 |
369 | {
370 |
371 | #Import Json
372 | $jsonfile=$json
373 | $jsonimport = Get-Content $jsonFile | ConvertFrom-Json
374 |
375 | #Change Name and ID
376 | $connectionString = $jsonimport | Select-Object -expand PortRules
377 | $connectionString.name = $jsonimport.PortRules.name + " - Imported"
378 | $connectionString.ID = $Null
379 |
380 |
381 | #Save Json
382 | Invoke-WebRequest https://"$servername":8000/api/portability -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.PortRules | ConvertTo-Json -Depth 10)
383 |
384 | }
385 | }
386 | }
387 |
388 | ## flexapppackage Functions (api/flexapppackage) ##
389 |
390 | ## List all Flexapps
391 | function Get-ProUFlexapps
392 | {
393 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/flexapppackage/ -WebSession $session).Content) | ConvertFrom-Json
394 | $PUG.TAG.ROWS
395 | }
396 |
397 |
398 | ## Load Flexapp ##
399 | function Edit-proUflexapp([string]$name, $quiet)
400 | {
401 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/flexapppackage -WebSession $session).Content) | ConvertFrom-Json
402 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -EQ $name} | ForEach-Object {$_.id}
403 | $PUG= ((Invoke-WebRequest https://"$servername":8000/api/flexapppackage/"$ID" -WebSession $session).Content) | ConvertFrom-Json
404 | $PUG=$PUG.tag
405 | $global:CurrentFlexapp = $PUG
406 | if ($quiet -eq $False){
407 | write-host "$name loaded for editing"
408 | }
409 | }
410 |
411 | ## Save Flexapp settings ##
412 | Function Save-ProUFlexapp{
413 | $answer=prompt-choice
414 | if ($answer -eq $False)
415 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
416 | else
417 | {
418 | Invoke-WebRequest https://"$servername":8000/api/flexapppackage -ContentType "application/json" -Method Post -WebSession $session -Body($CurrentFlexapp | ConvertTo-Json -Depth 10)
419 | }
420 | }
421 |
422 | ## Delete FlexApp ##
423 | function Remove-proUFlexapp([string]$name)
424 | {
425 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/flexapppackage -WebSession $session).Content) | ConvertFrom-Json
426 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -EQ $name} | ForEach-Object {$_.id}
427 | $response = Invoke-WebRequest https://"$servername":8000/api/flexapppackage/"$ID" -Method Delete -WebSession $session
428 | $Message=$response.Content | ConvertFrom-Json
429 | write-host $message.message
430 | }
431 |
432 | ## Import single Flexapp ##
433 | function Import-Prouflexapp([string]$path)
434 | {
435 | if (!$path)
436 | {
437 | Write-host -ForegroundColor red "Missing Source Path"
438 | }
439 | else
440 | {
441 | $response = ((Invoke-WebRequest https://"$servername":8000/api/server/flexapppackagexml?path=$path -Method Get -WebSession $session).Content) | ConvertFrom-Json
442 | $package = $response.Tag
443 | $response = (Invoke-WebRequest https://"$servername":8000/api/flexapppackage/import -Method Post -ContentType "application/json" -WebSession $session -Body (ConvertTo-Json -depth 10 @($package))) | ConvertFrom-Json
444 | }
445 | }
446 |
447 | ## Import All Flexapps ##
448 | Function Import-ProUFlexappsAll ($sourcedir)
449 | {
450 | if (!$sourcedir)
451 | {
452 | Write-host -ForegroundColor red "Missing Source Path dir"
453 | }
454 | else
455 | {
456 |
457 | $list=(Get-ChildItem $sourcedir -Recurse -include *.xml) | foreach-object {$_.FullName}
458 | foreach ($path in $list)
459 | {
460 | $response = ((Invoke-WebRequest https://"$servername":8000/api/server/flexapppackagexml?path=$path -Method Get -WebSession $session).Content) | ConvertFrom-Json
461 | $package = $response.Tag
462 | $response = (Invoke-WebRequest https://"$servername":8000/api/flexapppackage/import -Method Post -ContentType "application/json" -WebSession $session -Body (ConvertTo-Json -depth 10 @($package))) | ConvertFrom-Json
463 | }
464 | }
465 | }
466 |
467 | ## Add Flexapp Note ##
468 | function add-proUflexappNote([string]$note)
469 | {
470 | $m = $currentflexapp.History + "`n " + "Note:" + "$note"
471 | $currentflexapp.History = $m
472 | write-host "Use command Save-ProuFlexapp to save note to package" -BackgroundColor yellow -ForegroundColor red
473 | }
474 |
475 | ## Configuration Functions (api/configuration) ##
476 |
477 | ## Configuration Functions ##
478 |
479 | ## Get Configurations ##
480 | function Get-ProUconfig
481 | {
482 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
483 | $PUG.Tag.Rows
484 | }
485 |
486 | ## Load ProfileUnity Configurations ##
487 | function Edit-proUconfig([string]$name, $quiet)
488 | {
489 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
490 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
491 | $configR= ((Invoke-WebRequest https://"$servername":8000/api/configuration/"$ID" -WebSession $session).Content) | ConvertFrom-Json
492 | $config=$configR.tag
493 | $global:CurrentConfig = $config
494 | if ($quiet -eq $False){
495 | write-host "$name loaded for editing"
496 | }
497 | }
498 |
499 | ## Save Configuration settings ##
500 | Function Save-ProUConfig{
501 | $answer=prompt-choice
502 | if ($answer -eq $False)
503 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
504 | else
505 | {
506 | Invoke-WebRequest https://"$servername":8000/api/configuration -ContentType "application/json" -Method Post -WebSession $session -Body($Currentconfig | ConvertTo-Json -Depth 10)
507 | }
508 | }
509 |
510 |
511 | ## Delete Configuration ##
512 | function Remove-proUConfig([string]$name)
513 | {
514 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/filter -WebSession $session).Content) | ConvertFrom-Json
515 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -EQ $name} | ForEach-Object {$_.id}
516 | $response = Invoke-WebRequest https://"$servername":8000/api/configuration"$ID"?force=false -Method Delete -WebSession $session
517 | $Message=$response.Content | ConvertFrom-Json
518 | write-host $message.message
519 | }
520 |
521 |
522 | ## Export Single Configuration Json
523 | function Export-proUconfig([string]$name, $savepath)
524 | {
525 | if (!$savepath)
526 | {
527 | Write-host -ForegroundColor red "Missing Save Path"
528 | }
529 | else
530 | {
531 | #Load Config into memory
532 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
533 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
534 | #Export Config
535 | $ProgressPreference = 'SilentlyContinue'
536 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/configuration/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
537 | }
538 | }
539 |
540 | ## Export All Configurations Jsons ##
541 | Function Export-ProUConfigAll ($savepath)
542 | {
543 | if (!$savepath)
544 | {
545 | Write-host -ForegroundColor red "Missing Save Path"
546 | }
547 | else
548 | {
549 | #Get List
550 | $configlist=Get-prouconfigs
551 | [array]$configlist=$configlist.name
552 | #Export out all
553 | foreach ($name in $configlist)
554 | {
555 | #Load Configs into memory
556 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
557 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
558 |
559 | #Export Config
560 | #Invoke-WebRequest https://"$servername":8000/api/configuration/"$ID" -WebSession $session -OutFile "$savepath$name.json" -PassThru
561 | $ProgressPreference = 'SilentlyContinue'
562 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/configuration/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
563 | }
564 | }
565 | }
566 |
567 | ## Import Configuration Json ##
568 |
569 | ## Import Single Configuration Json
570 | Function Import-ProuConfig{
571 |
572 | #Import Json
573 | $jsonfile=Get-FileName
574 | $jsonimport=Get-Content $jsonFile | ConvertFrom-Json
575 |
576 | #Change Name and ID
577 | $connectionString = $jsonimport | select-object -expand configurations
578 | $connectionString.name = $jsonimport.Configurations.name + " - Imported"
579 | $connectionString.ID = $Null
580 |
581 |
582 | #Save Json
583 | Invoke-WebRequest https://"$servername":8000/api/configuration -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.configurations | ConvertTo-Json -Depth 10)
584 |
585 | }
586 |
587 |
588 | ## Import All Configuration Jsons ##
589 | Function Import-ProuConfigAll ($sourcedir)
590 | {
591 | if (!$sourcedir)
592 | {
593 | Write-host -ForegroundColor red "Missing Source Path dir"
594 | }
595 | else
596 | {
597 |
598 | $lists=Get-ChildItem $sourcedir
599 | $lists=$lists.VersionInfo.filename
600 | foreach ($json in $lists)
601 |
602 | {
603 |
604 | #Import Json
605 | $jsonfile=$json
606 | $jsonimport = Get-Content $jsonFile | ConvertFrom-Json
607 |
608 | #Change Name and ID
609 | $connectionString = $jsonimport | Select-Object -expand configurations
610 | $connectionString.name = $jsonimport.Configurations.name + " - Imported"
611 | $connectionString.ID = $Null
612 |
613 |
614 | #Save Json
615 | Invoke-WebRequest https://"$servername":8000/api/configuration -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.configurations | ConvertTo-Json -Depth 10)
616 |
617 | }
618 | }
619 | }
620 |
621 | ## Update Configuration ##
622 | Function Update-ProUConfig([string]$name)
623 | {
624 | $answer=prompt-choice
625 | if ($answer -eq $False)
626 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
627 | else
628 | {
629 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
630 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | ForEach-Object {$_.id}
631 | $URL="https://'$servername':8000/api/configuration/'$Id'/script?encoding=ascii&deploy=true"
632 | $URL=$URL -replace "'", ""
633 | Invoke-WebRequest "$URL" -WebSession $session
634 | }
635 | }
636 |
637 | ## Configuration Edit functions (api/configuration), When using Edit-proUconfig##
638 |
639 | ## Add-Flexapp to ProUConfig ##
640 |
641 | function Add-proUFlexAppDia([string]$DIAname, [string]$filtername){
642 |
643 | $dianame1 = Get-ProUFlexapps | Where-Object {$_.Name -eq "$DIAname"}
644 | $filterID1 = Get-ProUFilters | Where-Object {$_.Name -eq "$filtername"}
645 | $filterID = $filterID1.id
646 |
647 | $DIAPackage = @{
648 | DifferencingPath="%systemdrive%\FADIA-T\VHDW\%username%"
649 | UseJit="False"
650 | CacheLocal="False"
651 | PredictiveBlockCaching="False"
652 | FlexAppPackageId=$DIAname1.id
653 | FlexAppPackageUuid=$DIAName1.uuid
654 | Sequence = "0"
655 | }
656 |
657 | $global:moduleItem = @{
658 | FlexAppPackages=@($DIAPackage);
659 | Playback = "0"
660 | ReversePlay = "False"
661 | FilterId = "$filterID"
662 | Description="DIA package added with PowerTools"
663 | Disabled = "False"
664 | }
665 |
666 | $currentconfig.FlexAppDias += @($moduleItem)
667 |
668 | }
669 |
670 | #########################
--------------------------------------------------------------------------------
/PowerTools/PowerTools Core/ProUPowertoolsV2.0.B7.psm1:
--------------------------------------------------------------------------------
1 | <#
2 | .DISCLAIMER
3 | This script is provided "AS IS" with no warranties, confers no rights, and is not supported by Liquidware Labs.
4 |
5 | .SYNOPSIS
6 | ProfileUnity Powershell Commands and Functions
7 |
8 | .DESCRIPTION
9 | Made for ProfileUnity Command line modifications to configurations, Filters, and Portability Rules
10 | .NOTES
11 | NAME: ProUPowerTools2.0.B7.psm1
12 | AUTHOR: Jack Smith
13 | Email Address: Jack.Smith@liquidware.com
14 | Github: https://github.com/liquidwarelabs
15 | LASTEdit: 07/1/2025
16 | KEYWORDS: ProfileUnity, Powershell, Flexapp, Json
17 | Notes: v2.0B4
18 | Updates Added Case consistency to all functions
19 | Changes Deploy verb to Update verb (Update-ProUConfig)
20 | v2.0B5 added no status for speed increase
21 | Added in load for edit screen
22 | Added Silent Switched for load for edit.
23 | V2.0.B7
24 | Added new connect-profileunity function
25 | #>
26 |
27 | ## Supporting Core Functions ##
28 |
29 | ##Speed up Powershell Process show no progress##
30 | $ProgressPreference = 'SilentlyContinue'
31 |
32 |
33 | ##Prompt-Choice Function Library code
34 | function Prompt-Choice {
35 | #param (
36 | # [parameter(mandatory=$true)][string]$Title,
37 | # [parameter(mandatory=$true)][string]$Message
38 | #)
39 |
40 | $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", "Yes."
41 | $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", "No."
42 | $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no)
43 | $result = $host.ui.PromptForChoice($title, $message, $options, 0)
44 | switch ($result)
45 | {
46 | 0 { $true }
47 | 1 { $false }
48 | }
49 | }
50 |
51 |
52 | ## Get file path ##
53 | Function Get-FileName($jsonfile)
54 | {
55 | [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
56 | Out-Null
57 |
58 | $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
59 | $OpenFileDialog.initialDirectory = $initialDirectory
60 | $OpenFileDialog.filter = "All files (*.json*)| *.json*"
61 | $OpenFileDialog.ShowDialog() | Out-Null
62 | $OpenFileDialog.filename
63 | } #end function Get-FileName
64 |
65 |
66 | ##login Functions Cert exceptions##
67 |
68 | function Connect-ProfileUnityServer {
69 | [CmdletBinding(DefaultParameterSetName = 'Interactive')]
70 | param(
71 | [Parameter(Mandatory = $false)]
72 | [string]$ServerName,
73 |
74 | [Parameter(Mandatory = $false, ParameterSetName = 'PlainText')]
75 | [string]$Username,
76 |
77 | [Parameter(Mandatory = $false, ParameterSetName = 'PlainText')]
78 | [string]$Password,
79 |
80 | [Parameter(Mandatory = $false)]
81 | [int]$Port = 8000,
82 |
83 | [Parameter(Mandatory = $false)]
84 | [switch]$EnforceSSLValidation
85 | )
86 |
87 | try {
88 | # Get server name if not provided
89 | if (-not $ServerName) {
90 | $ServerName = Read-Host -Prompt 'Enter FQDN of ProfileUnity Server'
91 | if ([string]::IsNullOrWhiteSpace($ServerName)) {
92 | throw "Server name cannot be empty"
93 | }
94 | }
95 |
96 | # Get credentials
97 | if ([string]::IsNullOrWhiteSpace($Username) -or [string]::IsNullOrWhiteSpace($Password)) {
98 | Write-Host "Please enter your ProfileUnity credentials:" -ForegroundColor Yellow
99 |
100 | if ([string]::IsNullOrWhiteSpace($Username)) {
101 | $Username = Read-Host -Prompt "Username"
102 | }
103 |
104 | $SecurePassword = Read-Host -Prompt "Password for $Username" -AsSecureString
105 | $Credential = New-Object System.Management.Automation.PSCredential($Username, $SecurePassword)
106 | } else {
107 | $securePass = ConvertTo-SecureString -String $Password -AsPlainText -Force
108 | $Credential = New-Object System.Management.Automation.PSCredential($Username, $securePass)
109 | }
110 |
111 | # Handle SSL certificate validation (bypass by default)
112 | if (-not $EnforceSSLValidation) {
113 | Write-Verbose "SSL certificate validation will be bypassed (default behavior)"
114 |
115 | if (-not ([System.Management.Automation.PSTypeName]'TrustAllCertsPolicy').Type) {
116 | Add-Type @"
117 | using System.Net;
118 | using System.Security.Cryptography.X509Certificates;
119 | public class TrustAllCertsPolicy : ICertificatePolicy {
120 | public bool CheckValidationResult(
121 | ServicePoint srvPoint, X509Certificate certificate,
122 | WebRequest request, int certificateProblem) {
123 | return true;
124 | }
125 | }
126 | "@
127 | }
128 | [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
129 | }
130 |
131 | # Set modern TLS protocols
132 | [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 -bor [System.Net.SecurityProtocolType]::Tls13
133 |
134 | # Construct the authentication URL
135 | $authUrl = "https://${ServerName}:${Port}/authenticate"
136 | Write-Host "Connecting to ProfileUnity server: $ServerName" -ForegroundColor Green
137 |
138 | # Prepare authentication body in ProfileUnity format
139 | $username = $Credential.UserName
140 | $password = $Credential.GetNetworkCredential().Password
141 | $authBody = "username=$username&password=$password"
142 |
143 | # Create web request parameters
144 | $requestParams = @{
145 | Uri = $authUrl
146 | Method = 'POST'
147 | Body = $authBody
148 | SessionVariable = 'webSession'
149 | TimeoutSec = 30
150 | ErrorAction = 'Stop'
151 | }
152 |
153 | # Attempt authentication
154 | $response = Invoke-WebRequest @requestParams
155 |
156 | # Check if authentication was successful
157 | if ($response.StatusCode -eq 200) {
158 | $global:session = $webSession
159 | $global:servername = $ServerName
160 |
161 | Write-Host "Successfully connected to ProfileUnity server: $ServerName" -ForegroundColor Green
162 |
163 | return [PSCustomObject]@{
164 | ServerName = $ServerName
165 | Port = $Port
166 | Connected = $true
167 | AuthenticationTime = Get-Date
168 | }
169 | } else {
170 | throw "Authentication failed with status code: $($response.StatusCode)"
171 | }
172 |
173 | } catch {
174 | Write-Error "Connection failed: $($_.Exception.Message)"
175 | throw
176 | } finally {
177 | # Clear sensitive data
178 | if ($Credential) {
179 | $Credential = $null
180 | }
181 | }
182 | }
183 |
184 | # Quick test function
185 | function Test-ProfileUnityConnection {
186 | if ($global:session -and $global:servername) {
187 | Write-Host "Connection active to: $($global:servername)" -ForegroundColor Green
188 | return $true
189 | } else {
190 | Write-Host "No active connection found" -ForegroundColor Yellow
191 | return $false
192 | }
193 | }
194 |
195 | ## Login Function End ##
196 |
197 |
198 | ## Filter Functions (api/filter)
199 |
200 | ## Get Filter ##
201 | function Get-ProUFilters
202 | {
203 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/Filter -WebSession $session).Content) | ConvertFrom-Json
204 | $PUG.Tag.Rows
205 | }
206 |
207 | ## Load ProfileUnity Filters ##
208 | function Edit-ProUFilter([string]$name, $quiet)
209 | {
210 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/Filter -WebSession $session).Content) | ConvertFrom-Json
211 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
212 | $configR= ((Invoke-WebRequest https://"$servername":8000/api/Filter/"$ID" -WebSession $session).Content) | ConvertFrom-Json
213 | $config=$configR.tag
214 | $global:CurrentFilter = $config
215 | if ($quiet -eq $False){
216 | write-host "$name loaded for editing"
217 | }
218 | }
219 |
220 | ## Save Filter settings ##
221 | Function Save-ProUFilter{
222 | $answer=prompt-choice
223 | if ($answer -eq $False)
224 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
225 | else
226 | {
227 | Invoke-WebRequest https://"$servername":8000/api/Filter -ContentType "application/json" -Method Post -WebSession $session -Body($CurrentFilter | ConvertTo-Json -Depth 10)
228 | }
229 | }
230 |
231 |
232 | ## Delete Filter ##
233 | function Remove-ProUFilter([string]$name)
234 | {
235 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/filter -WebSession $session).Content) | ConvertFrom-Json
236 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -EQ $name} | ForEach-Object {$_.id}
237 | $response = Invoke-WebRequest https://"$servername":8000/api/Filter"$ID"?force=false -Method Delete -WebSession $session
238 | $Message=$response.Content | ConvertFrom-Json
239 | write-host $message.message
240 | }
241 |
242 |
243 | ## Export Single Filter Json
244 | function Export-ProUFilter([string]$name, $savepath)
245 | {
246 | if (!$savepath)
247 | {
248 | Write-host -ForegroundColor red "Missing Save Path"
249 | }
250 | else
251 | {
252 | #Load Filter into memory
253 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/Filter -WebSession $session).Content) | ConvertFrom-Json
254 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
255 | #Export Filter
256 | $ProgressPreference = 'SilentlyContinue'
257 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/Filter/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
258 | }
259 | }
260 |
261 | ## Export All Filters Jsons ##
262 | Function Export-ProUFilterAll ($savepath)
263 | {
264 | if (!$savepath)
265 | {
266 | Write-host -ForegroundColor red "Missing Save Path"
267 | }
268 | else
269 | {
270 | #Get List
271 | $list=Get-ProUFilters
272 | [array]$list=$list.name
273 | #Export out all
274 | foreach ($name in $list)
275 | {
276 | #Load Configs into memory
277 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/Filter -WebSession $session).Content) | ConvertFrom-Json
278 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
279 |
280 | #Export Items
281 | #Invoke-WebRequest https://"$servername":8000/api/Filter/"$ID" -WebSession $session -OutFile "$savepath$name.json" -PassThru
282 | $ProgressPreference = 'SilentlyContinue'
283 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/Filter/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
284 | }
285 | }
286 | }
287 |
288 | ## Import Filter Json ##
289 |
290 | ## Import Single Filter Json
291 | Function Import-ProUFilter{
292 |
293 | #Import Json
294 | $jsonfile=Get-FileName
295 | $jsonimport=Get-Content $jsonFile | ConvertFrom-Json
296 |
297 | #Change Name and ID
298 | $connectionString = $jsonimport | select-object -expand Filters
299 | $connectionString.name = $jsonimport.Filters.name + " - Imported"
300 | $connectionString.ID = $Null
301 |
302 |
303 | #Save Json
304 | Invoke-WebRequest https://"$servername":8000/api/Filter -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.Filters | ConvertTo-Json -Depth 10)
305 |
306 | }
307 |
308 |
309 | ## Import All Filter Jsons ##
310 | Function Import-ProUFilterAll ($sourceDir)
311 | {
312 | if (!$sourcedir)
313 | {
314 | Write-host -ForegroundColor red "Missing Source Path Dir"
315 | }
316 | else
317 | {
318 |
319 | $lists=Get-ChildItem $sourcedir
320 | $lists=$lists.VersionInfo.filename
321 | foreach ($json in $lists)
322 |
323 | {
324 |
325 | #Import Json
326 | $jsonfile=$json
327 | $jsonimport = Get-Content $jsonFile | ConvertFrom-Json
328 |
329 | #Change Name and ID
330 | $connectionString = $jsonimport | Select-Object -expand Filters
331 | $connectionString.name = $jsonimport.Filters.name + " - Imported"
332 | $connectionString.ID = $Null
333 |
334 |
335 | #Save Json
336 | Invoke-WebRequest https://"$servername":8000/api/Filter -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.Filters | ConvertTo-Json -Depth 10)
337 |
338 | }
339 | }
340 | }
341 |
342 | ## Portability Functions (api/portability) ##
343 |
344 | ## Get PortRule ##
345 | function Get-ProUPortRule
346 | {
347 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
348 | $PUG.Tag.Rows
349 | }
350 |
351 | ## Load ProfileUnity PortRules ##
352 | function Edit-ProUPortRule([string]$name, $quiet)
353 | {
354 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
355 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
356 | $configR= ((Invoke-WebRequest https://"$servername":8000/api/portability/"$ID" -WebSession $session).Content) | ConvertFrom-Json
357 | $config=$configR.tag
358 | $global:CurrentPortRule= $config
359 | if ($quiet -eq $False){
360 | write-host "$name loaded for editing"
361 | }
362 | }
363 |
364 | ## Save PortRule settings ##
365 | Function Save-ProUPortRule{
366 | $answer=prompt-choice
367 | if ($answer -eq $False)
368 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
369 | else
370 | {
371 | Invoke-WebRequest https://"$servername":8000/api/portability -ContentType "application/json" -Method Post -WebSession $session -Body($CurrentPortRule | ConvertTo-Json -Depth 10)
372 | }
373 | }
374 |
375 |
376 | ## Delete PortRule ##
377 | function Remove-ProUPortRule([string]$name)
378 | {
379 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
380 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -EQ $name} | ForEach-Object {$_.id}
381 | $response = Invoke-WebRequest https://"$servername":8000/api/portability"$ID"?force=false -Method Delete -WebSession $session
382 | $Message=$response.Content | ConvertFrom-Json
383 | write-host $message.message
384 | }
385 |
386 |
387 | ## Export Single PortRule Json
388 | function Export-ProUPortRule([string]$name, $savepath)
389 | {
390 | if (!$savepath)
391 | {
392 | Write-host -ForegroundColor red "Missing Save Path"
393 | }
394 | else
395 | {
396 | #Load PortRule into memory
397 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
398 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
399 | #Export PortRule
400 | $ProgressPreference = 'SilentlyContinue'
401 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/portability/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
402 | }
403 | }
404 |
405 | ## Export All PortRules Jsons ##
406 | Function Export-ProUPortRuleAll ($savepath)
407 | {
408 | if (!$savepath)
409 | {
410 | Write-host -ForegroundColor red "Missing Save Path"
411 | }
412 | else
413 | {
414 | #Get List
415 | $list=Get-ProUPortRules
416 | [array]$list=$list.name
417 | #Export out all
418 | foreach ($name in $list)
419 | {
420 | #Load Configs into memory
421 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/portability -WebSession $session).Content) | ConvertFrom-Json
422 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
423 |
424 | #Export Items
425 | #Invoke-WebRequest https://"$servername":8000/api/portability/"$ID" -WebSession $session -OutFile "$savepath$name.json" -PassThru
426 | $ProgressPreference = 'SilentlyContinue'
427 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/portability/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
428 | }
429 | }
430 | }
431 |
432 | ## Import PortRule Json ##
433 |
434 | ## Import Single PortRule Json
435 | Function Import-ProUPortRule{
436 |
437 | #Import Json
438 | $jsonfile=Get-FileName
439 | $jsonimport=Get-Content $jsonFile | ConvertFrom-Json
440 |
441 | #Change Name and ID
442 | $connectionString = $jsonimport | select-object -expand portability
443 | $connectionString.name = $jsonimport.portability.name + " - Imported"
444 | $connectionString.ID = $Null
445 |
446 |
447 | #Save Json
448 | Invoke-WebRequest https://"$servername":8000/api/portability -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.portrules | ConvertTo-Json -Depth 10)
449 |
450 | }
451 |
452 |
453 | ## Import All PortRule Jsons ##
454 | Function Import-ProUPortRuleAll ($sourcedir)
455 | {
456 | if (!$sourcedir)
457 | {
458 | Write-host -ForegroundColor red "Missing Source Path Dir"
459 | }
460 | else
461 | {
462 |
463 | $lists=Get-ChildItem $sourcedir
464 | $lists=$lists.VersionInfo.filename
465 | foreach ($json in $lists)
466 |
467 | {
468 |
469 | #Import Json
470 | $jsonfile=$json
471 | $jsonimport = Get-Content $jsonFile | ConvertFrom-Json
472 |
473 | #Change Name and ID
474 | $connectionString = $jsonimport | Select-Object -expand PortRules
475 | $connectionString.name = $jsonimport.PortRules.name + " - Imported"
476 | $connectionString.ID = $Null
477 |
478 |
479 | #Save Json
480 | Invoke-WebRequest https://"$servername":8000/api/portability -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.PortRules | ConvertTo-Json -Depth 10)
481 |
482 | }
483 | }
484 | }
485 |
486 | ## flexapppackage Functions (api/flexapppackage) ##
487 |
488 | ## List all Flexapps
489 | function Get-ProUFlexapps
490 | {
491 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/flexapppackage/ -WebSession $session).Content) | ConvertFrom-Json
492 | $PUG.TAG.ROWS
493 | }
494 |
495 |
496 | ## Load Flexapp ##
497 | function Edit-proUflexapp([string]$name, $quiet)
498 | {
499 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/flexapppackage -WebSession $session).Content) | ConvertFrom-Json
500 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -EQ $name} | ForEach-Object {$_.id}
501 | $PUG= ((Invoke-WebRequest https://"$servername":8000/api/flexapppackage/"$ID" -WebSession $session).Content) | ConvertFrom-Json
502 | $PUG=$PUG.tag
503 | $global:CurrentFlexapp = $PUG
504 | if ($quiet -eq $False){
505 | write-host "$name loaded for editing"
506 | }
507 | }
508 |
509 | ## Save Flexapp settings ##
510 | Function Save-ProUFlexapp{
511 | $answer=prompt-choice
512 | if ($answer -eq $False)
513 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
514 | else
515 | {
516 | Invoke-WebRequest https://"$servername":8000/api/flexapppackage -ContentType "application/json" -Method Post -WebSession $session -Body($CurrentFlexapp | ConvertTo-Json -Depth 10)
517 | }
518 | }
519 |
520 | ## Delete FlexApp ##
521 | function Remove-proUFlexapp([string]$name)
522 | {
523 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/flexapppackage -WebSession $session).Content) | ConvertFrom-Json
524 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -EQ $name} | ForEach-Object {$_.id}
525 | $response = Invoke-WebRequest https://"$servername":8000/api/flexapppackage/"$ID" -Method Delete -WebSession $session
526 | $Message=$response.Content | ConvertFrom-Json
527 | write-host $message.message
528 | }
529 |
530 | ## Import single Flexapp ##
531 | function Import-Prouflexapp([string]$path)
532 | {
533 | if (!$path)
534 | {
535 | Write-host -ForegroundColor red "Missing Source Path"
536 | }
537 | else
538 | {
539 | $response = ((Invoke-WebRequest https://"$servername":8000/api/server/flexapppackagexml?path=$path -Method Get -WebSession $session).Content) | ConvertFrom-Json
540 | $package = $response.Tag
541 | $response = (Invoke-WebRequest https://"$servername":8000/api/flexapppackage/import -Method Post -ContentType "application/json" -WebSession $session -Body (ConvertTo-Json -depth 10 @($package))) | ConvertFrom-Json
542 | }
543 | }
544 |
545 | ## Import All Flexapps ##
546 | Function Import-ProUFlexappsAll ($sourcedir)
547 | {
548 | if (!$sourcedir)
549 | {
550 | Write-host -ForegroundColor red "Missing Source Path dir"
551 | }
552 | else
553 | {
554 |
555 | $list=(Get-ChildItem $sourcedir -Recurse -include *.xml) | foreach-object {$_.FullName}
556 | foreach ($path in $list)
557 | {
558 | $response = ((Invoke-WebRequest https://"$servername":8000/api/server/flexapppackagexml?path=$path -Method Get -WebSession $session).Content) | ConvertFrom-Json
559 | $package = $response.Tag
560 | $response = (Invoke-WebRequest https://"$servername":8000/api/flexapppackage/import -Method Post -ContentType "application/json" -WebSession $session -Body (ConvertTo-Json -depth 10 @($package))) | ConvertFrom-Json
561 | }
562 | }
563 | }
564 |
565 | ## Add Flexapp Note ##
566 | function add-proUflexappNote([string]$note)
567 | {
568 | $m = $currentflexapp.History + "`n " + "Note:" + "$note"
569 | $currentflexapp.History = $m
570 | write-host "Use command Save-ProuFlexapp to save note to package" -BackgroundColor yellow -ForegroundColor red
571 | }
572 |
573 | ## Configuration Functions (api/configuration) ##
574 |
575 | ## Configuration Functions ##
576 |
577 | ## Get Configurations ##
578 | function Get-ProUconfig
579 | {
580 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
581 | $PUG.Tag.Rows
582 | }
583 |
584 | ## Load ProfileUnity Configurations ##
585 | function Edit-proUconfig([string]$name, $quiet)
586 | {
587 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
588 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
589 | $configR= ((Invoke-WebRequest https://"$servername":8000/api/configuration/"$ID" -WebSession $session).Content) | ConvertFrom-Json
590 | $config=$configR.tag
591 | $global:CurrentConfig = $config
592 | if ($quiet -eq $False){
593 | write-host "$name loaded for editing"
594 | }
595 | }
596 |
597 | ## Save Configuration settings ##
598 | Function Save-ProUConfig{
599 | $answer=prompt-choice
600 | if ($answer -eq $False)
601 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
602 | else
603 | {
604 | Invoke-WebRequest https://"$servername":8000/api/configuration -ContentType "application/json" -Method Post -WebSession $session -Body($Currentconfig | ConvertTo-Json -Depth 10)
605 | }
606 | }
607 |
608 |
609 | ## Delete Configuration ##
610 | function Remove-proUConfig([string]$name)
611 | {
612 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/filter -WebSession $session).Content) | ConvertFrom-Json
613 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -EQ $name} | ForEach-Object {$_.id}
614 | $response = Invoke-WebRequest https://"$servername":8000/api/configuration"$ID"?force=false -Method Delete -WebSession $session
615 | $Message=$response.Content | ConvertFrom-Json
616 | write-host $message.message
617 | }
618 |
619 |
620 | ## Export Single Configuration Json
621 | function Export-proUconfig([string]$name, $savepath)
622 | {
623 | if (!$savepath)
624 | {
625 | Write-host -ForegroundColor red "Missing Save Path"
626 | }
627 | else
628 | {
629 | #Load Config into memory
630 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
631 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
632 | #Export Config
633 | $ProgressPreference = 'SilentlyContinue'
634 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/configuration/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
635 | }
636 | }
637 |
638 | ## Export All Configurations Jsons ##
639 | Function Export-ProUConfigAll ($savepath)
640 | {
641 | if (!$savepath)
642 | {
643 | Write-host -ForegroundColor red "Missing Save Path"
644 | }
645 | else
646 | {
647 | #Get List
648 | $configlist=Get-prouconfigs
649 | [array]$configlist=$configlist.name
650 | #Export out all
651 | foreach ($name in $configlist)
652 | {
653 | #Load Configs into memory
654 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
655 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | foreach-object {$_.id}
656 |
657 | #Export Config
658 | #Invoke-WebRequest https://"$servername":8000/api/configuration/"$ID" -WebSession $session -OutFile "$savepath$name.json" -PassThru
659 | $ProgressPreference = 'SilentlyContinue'
660 | Invoke-RestMethod -ContentType "application/octet-stream" -Uri https://"$servername":8000/api/configuration/"$ID"/download?encoding=default -WebSession $session -OutFile "$savepath$name.json"
661 | }
662 | }
663 | }
664 |
665 | ## Import Configuration Json ##
666 |
667 | ## Import Single Configuration Json
668 | Function Import-ProuConfig{
669 |
670 | #Import Json
671 | $jsonfile=Get-FileName
672 | $jsonimport=Get-Content $jsonFile | ConvertFrom-Json
673 |
674 | #Change Name and ID
675 | $connectionString = $jsonimport | select-object -expand configurations
676 | $connectionString.name = $jsonimport.Configurations.name + " - Imported"
677 | $connectionString.ID = $Null
678 |
679 |
680 | #Save Json
681 | Invoke-WebRequest https://"$servername":8000/api/configuration -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.configurations | ConvertTo-Json -Depth 10)
682 |
683 | }
684 |
685 |
686 | ## Import All Configuration Jsons ##
687 | Function Import-ProuConfigAll ($sourcedir)
688 | {
689 | if (!$sourcedir)
690 | {
691 | Write-host -ForegroundColor red "Missing Source Path dir"
692 | }
693 | else
694 | {
695 |
696 | $lists=Get-ChildItem $sourcedir
697 | $lists=$lists.VersionInfo.filename
698 | foreach ($json in $lists)
699 |
700 | {
701 |
702 | #Import Json
703 | $jsonfile=$json
704 | $jsonimport = Get-Content $jsonFile | ConvertFrom-Json
705 |
706 | #Change Name and ID
707 | $connectionString = $jsonimport | Select-Object -expand configurations
708 | $connectionString.name = $jsonimport.Configurations.name + " - Imported"
709 | $connectionString.ID = $Null
710 |
711 |
712 | #Save Json
713 | Invoke-WebRequest https://"$servername":8000/api/configuration -ContentType "application/json" -Method Post -WebSession $session -Body($jsonimport.configurations | ConvertTo-Json -Depth 10)
714 |
715 | }
716 | }
717 | }
718 |
719 | ## Update Configuration ##
720 | Function Update-ProUConfig([string]$name)
721 | {
722 | $answer=prompt-choice
723 | if ($answer -eq $False)
724 | {Write-Host "Save Canceled" -ForegroundColor "red" -BackgroundColor "yellow"}
725 | else
726 | {
727 | $PUG = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
728 | [string]$ID=$PUG.Tag.Rows | Where-Object {$_.name -Match $name} | ForEach-Object {$_.id}
729 | $URL="https://'$servername':8000/api/configuration/'$Id'/script?encoding=ascii&deploy=true"
730 | $URL=$URL -replace "'", ""
731 | Invoke-WebRequest "$URL" -WebSession $session
732 | }
733 | }
734 |
735 | ## Configuration Edit functions (api/configuration), When using Edit-proUconfig##
736 |
737 | ## Add-Flexapp to ProUConfig ##
738 |
739 | function Add-proUFlexAppDia([string]$DIAname, [string]$filtername){
740 |
741 | $dianame1 = Get-ProUFlexapps | Where-Object {$_.Name -eq "$DIAname"}
742 | $filterID1 = Get-ProUFilters | Where-Object {$_.Name -eq "$filtername"}
743 | $filterID = $filterID1.id
744 |
745 | $DIAPackage = @{
746 | DifferencingPath="%systemdrive%\FADIA-T\VHDW\%username%"
747 | UseJit="False"
748 | CacheLocal="False"
749 | PredictiveBlockCaching="False"
750 | FlexAppPackageId=$DIAname1.id
751 | FlexAppPackageUuid=$DIAName1.uuid
752 | Sequence = "0"
753 | }
754 |
755 | $global:moduleItem = @{
756 | FlexAppPackages=@($DIAPackage);
757 | Playback = "0"
758 | ReversePlay = "False"
759 | FilterId = "$filterID"
760 | Description="DIA package added with PowerTools"
761 | Disabled = "False"
762 | }
763 |
764 | $currentconfig.FlexAppDias += @($moduleItem)
765 |
766 | }
767 |
768 | #########################
--------------------------------------------------------------------------------
/PowerTools/PowerTools Core/ReadMe.MD:
--------------------------------------------------------------------------------
1 | ## ProfileUnity PowerTools
2 |
3 | **Description**
4 | This Is a powershell module that can be used to create change and save items with in the ProfileUnity Web Console.
5 |
6 | **How to Use**
7 |
8 | **Prerequisites**
9 | This was built on the latest version of PowerShell.
10 | https://www.microsoft.com/en-us/download/details.aspx?id=50395
11 |
12 | To load
13 | - **copy the PSM1 down into a folder.**
14 | - **In PowerShell type**:
15 | ````
16 | Import-module .\ProUPowerTools.v1.4.psm1
17 | ````
18 | - **If you get an Execution Policy error.**
19 | ````
20 | Set-ExecutionPolicy -ExecutionPolicy Unrestricted
21 | ````
22 | This is really basic, no editing stuff just yet just doing a quick trial run on it.
23 |
24 | **Please be careful, with this as you could break your stuff if you aren’t careful mainly in the import/Export json stuff, thought it should be ok.**
25 |
26 |
27 | Things you can do in V1:
28 | ````
29 | connect-ProfileUnityServer
30 | Type in command and follow the prompts
31 |
32 | get-ProUconfigs
33 | Type in command get responce
34 |
35 | get-ProUFilters
36 | Type in command get responce
37 |
38 | get-ProUFlexapps
39 | Type in command get responce
40 |
41 | get-ProUPortRules
42 | Type in command get responce
43 |
44 | load-proUconfig([string]$name)
45 | Example: load-proUconfig -name "configuration name"
46 | $Currentconfig
47 |
48 | load-proUPortRule([string]$name)
49 | Example: load-proUPortRule -name "Port Rule Name"
50 | $CurrentPortRule
51 |
52 | load-proUfilter([string]$name)
53 | Example: load-proUfilter -name "Filter Name"
54 | $Currentfilter
55 |
56 | Save-ProUConfig
57 | Type in command get responce
58 |
59 | Save-ProUPortRule
60 | Type in command get responce
61 |
62 | Save-ProUFilter
63 | Type in command get responce
64 |
65 | export-proUconfig([string]$name, $savepath)
66 | Example: export-proUconfig -name "configuration name" -savepath "c:\Path\"
67 | The backslash at the end of the path is important
68 |
69 | Export-ProUConfigAll ($savepath)
70 | Example: Export-ProUConfigAll -savepath "c:\Path\"
71 | The backslash at the end of the path is important
72 |
73 | Import-ProuConfig
74 | Type in command and follow the prompts
75 |
76 | Import-ProuConfigAll ($source)
77 | Example: Import-ProuConfigAll -source "c:\Path\"
78 | The backslash at the end of the path is important
79 | ````
80 |
81 |
82 |
83 | | OS Version | Verified |
84 | | ------------- | ------------- |
85 | |Windows 10 | Yes |
86 | |Windows 2019 | Yes |
87 | |Windows 2016 | Yes |
88 | |Windows Server 2012 | No |
89 | |Windows Server 2012 R2 | Yes |
90 | |Windows 8 | No |
91 | |Windows 7 | Yes |
--------------------------------------------------------------------------------
/PowerTools/Printer Creation from Template/Printer Add.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/PowerTools/Printer Creation from Template/Printer Add.zip
--------------------------------------------------------------------------------
/PowerTools/Printer Creation from Template/ReadMe.MD:
--------------------------------------------------------------------------------
1 | ## ProfileUnity Backup
2 |
3 | **Description**
4 | This Is a powershell script that will pull printer settings from a CSV and input them into the ProfileUnity Web Console.
5 |
6 | **How to Use**
7 |
8 | **Prerequisites**
9 | This was built on the latest version of PowerShell.
10 | https://www.microsoft.com/en-us/download/details.aspx?id=50395
11 |
12 | Download Zip with Script
13 | https://github.com/liquidwarelabs/ProfileUnity/raw/master/PowerTools/Printer%20Printer%20Creation%20from%20Template/Printer%20Add.zip
14 |
15 | **To load**
16 |
17 | - **copy the PS1 down into a folder on the profileunity server.**
18 | - **Edit the CSV with the items needed**
19 |
20 | - 1. Follow guide to set the fields correctly.
21 |
22 | - **In PowerShell type**:
23 | ````
24 | Run “add-printer.ps1”
25 | Follow prompts
26 | ````
27 | - **If you get an Execution Policy error.**
28 | ````
29 | Set-ExecutionPolicy -ExecutionPolicy Unrestricted
30 | ````
31 |
32 |
33 | Script Code add-printer.ps1:
34 | ````
35 |
36 | ##login Function
37 |
38 | function connect-ProfileUnityServer{
39 | ##Ignore-SSL Library Code
40 | add-type @"
41 | using System.Net;
42 | using System.Security.Cryptography.X509Certificates;
43 | public class TrustAllCertsPolicy : ICertificatePolicy {
44 | public bool CheckValidationResult(
45 | ServicePoint srvPoint, X509Certificate certificate,
46 | WebRequest request, int certificateProblem) {
47 | return true;
48 | }
49 | }
50 | "@
51 | [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
52 |
53 | ##Get Creds
54 | [string]$global:servername= Read-Host -Prompt 'FQDN of ProfileUnity Server Name'
55 | $user = Read-Host "Enter Username"
56 | $pass = Read-Host -assecurestring "Enter Password"
57 | $pass2=[Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass))
58 |
59 | #Connect to Server
60 | Invoke-WebRequest https://"$servername":8000/authenticate -Body "username=$user&password=$pass2" -Method Post -SessionVariable session
61 | $global:session=$session
62 | }
63 |
64 | Function Get-FileName($CSV)
65 | {
66 | [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
67 | Out-Null
68 |
69 | $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
70 | $OpenFileDialog.initialDirectory = $initialDirectory
71 | $OpenFileDialog.filter = "All files (*.*)| *.*"
72 | $OpenFileDialog.ShowDialog() | Out-Null
73 | $OpenFileDialog.filename
74 | } #end function Get-FileName
75 |
76 | connect-ProfileUnityServer
77 |
78 | $PrinterCSV=Get-FileName
79 | $list=import-csv $PrinterCSV
80 |
81 | foreach ($Printer in $list){
82 | $newPrinter=[pscustomobject]$list
83 | $PUGC = ((Invoke-WebRequest https://"$servername":8000/api/configuration -WebSession $session).Content) | ConvertFrom-Json
84 | [string]$configID=$PUGC.Tag.Rows | Where-Object {$_.name -EQ $Configname} | foreach {$_.id}
85 | $configR= ((Invoke-WebRequest https://"$servername":8000/api/configuration/"$configID" -WebSession $session).Content) | ConvertFrom-Json
86 | $config=$configR.tag
87 |
88 | $config.Printers += $Printer
89 | Invoke-WebRequest https://"$servername":8000/api/configuration -ContentType "application/json" -Method Post -WebSession $session -Body($config | ConvertTo-Json -Depth 10)
90 | }
91 |
92 |
93 |
94 | ````
95 |
96 |
97 |
98 |
99 | | OS Version | Verified |
100 | | ------------- | ------------- |
101 | |Windows 10 | Yes |
102 | |Windows 2019 | Yes |
103 | |Windows 2016 | Yes |
104 | |Windows Server 2012 | No |
105 | |Windows Server 2012 R2 | Yes |
106 | |Windows 8 | No |
107 | |Windows 7 | Yes |
--------------------------------------------------------------------------------
/PowerTools/ProfileUnity Backup/BackupDBv4.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/PowerTools/ProfileUnity Backup/BackupDBv4.zip
--------------------------------------------------------------------------------
/PowerTools/ProfileUnity Backup/ReadMe.MD:
--------------------------------------------------------------------------------
1 | ## ProfileUnity Backup
2 |
3 | **Description**
4 | This Is a powershell script that will backup the items in the ProfileUnity Web Console.
5 |
6 | **How to Use**
7 |
8 | **Prerequisites**
9 | This was built on the latest version of PowerShell.
10 | https://www.microsoft.com/en-us/download/details.aspx?id=50395
11 |
12 | Download Zip with Backup Script
13 | https://github.com/liquidwarelabs/ProfileUnity/raw/master/PowerTools/ProfileUnity%20Backup/BackupDBv3.zip
14 |
15 | To load
16 | - **copy the PS1 down into a folder on the profileunity server.**
17 | - **Make Secure Password file**
18 | - 1. Make secure password string file.
19 |
20 | - **In PowerShell type**:
21 | ````
22 | Run “MakeSecurePasswordfile-AES.ps1”
23 | Follow prompts
24 | ````
25 | - **If you get an Execution Policy error.**
26 | ````
27 | Set-ExecutionPolicy -ExecutionPolicy Unrestricted
28 | ````
29 |
30 | - **Example**
31 | - .\backupDBv3.ps1 -servername "pro2020.foo.local" -ASEKeyFileLocation "C:\temp\BackupDBv3\aeskey.txt" -passwordFileLocation "C:\temp\BackupDBv3\password.txt" -savepath "c:\temp\" -purgeold -backupcount 3
32 |
33 | - **Override Flags**
34 | - servername
35 | - user
36 | - passwordFileLocation
37 | - ASEKeyFileLocation
38 | - savepath
39 | - purgeold
40 | - backupcount
41 |
42 | - **Make Task**
43 | - On ProfileUnity server start “Task Scheduler”
44 | - Create new task
45 | - **Follow the instruction specified on this site.**
46 | - https://community.spiceworks.com/how_to/17736-run-powershell-scripts-from-task-scheduler
47 |
48 |
49 | Script Code MakeSecurePasswordfile-AES.ps1:
50 | ````
51 | # Prompt you to enter the username and password
52 | $credObject = Get-Credential
53 |
54 | # The credObject now holds the password in a ‘securestring’ format
55 | $passwordSecureString = $credObject.password
56 |
57 | # Define a location to store the AESKey
58 | $AESKeyFilePath = "C:\Program Files (x86)\Liquidware Labs\FlexApp Packaging Console\aeskey.txt"
59 | # Define a location to store the file that hosts the encrypted password
60 | $credentialFilePath = "C:\Program Files (x86)\Liquidware Labs\FlexApp Packaging Console\password.txt"
61 |
62 | # Generate a random AES Encryption Key.
63 | $AESKey = New-Object Byte[] 32
64 | [Security.Cryptography.RNGCryptoServiceProvider]::Create().GetBytes($AESKey)
65 |
66 | # Store the AESKey into a file. This file should be protected! (e.g. ACL on the file to allow only select people to read)
67 |
68 | Set-Content $AESKeyFilePath $AESKey # Any existing AES Key file will be overwritten
69 |
70 | $password = $passwordSecureString | ConvertFrom-SecureString -Key $AESKey
71 |
72 | Add-Content $credentialFilePath $password
73 | ````
74 |
75 |
76 |
77 | Script Code backupDBv3.ps1:
78 | ````
79 | <#
80 | .SYNOPSIS
81 | Back up Profile Unity Database Script for scheduled task
82 | .DESCRIPTION
83 | Back up Profile Unity Database Script for scheduled task
84 | .NOTES
85 | Version: 4.0
86 | Author: Ryan Butler (AHEAD)
87 | Update Author: Jack Smith (Liquidware)
88 | Creation Date: 01-21-2019
89 | Purpose/Change: Based on https://github.com/liquidwarelabs/ProfileUnity/tree/master/PowerTools/ProfileUnity%20Backup
90 | .PARAMETER servername
91 | Profile Unity server name
92 | .PARAMETER User
93 | Profile Unity username
94 | .PARAMETER passwordFileLocation
95 | Password file location
96 | .PARAMETER ASEKeyFileLocation
97 | ASE file location
98 | .PARAMETER SavePath
99 | Location to store backup files (Optional trailing \)
100 | .PARAMETER purgeold
101 | Purge old local backup file(s) (optional)
102 | .PARAMETER backupcount
103 | How many local backups to keep (works with PurgeOld)
104 | .EXAMPLE
105 | Runs backup of the profileunity database and keeps the 3 latest backups
106 | .\backupDBv4.ps1 -servername "ProUserver.domain.local" -user "administrator" -ASEKeyFileLocation "C:\temp\aeskey.txt" -passwordFileLocation "C:\temp\password.txt" -savepath "c:\temp\" -purgeold -backupcount 3
107 | #>
108 | [cmdletbinding()]
109 | Param
110 | (
111 | [Parameter(Mandatory=$true)][string]$servername,
112 | [Parameter(Mandatory=$false)][string]$user,
113 | [Parameter(Mandatory=$true)][string]$passwordFileLocation,
114 | [Parameter(Mandatory=$true)][string]$ASEKeyFileLocation,
115 | [Parameter(Mandatory=$true)][string]$savepath,
116 | [Parameter(Mandatory=$false)][switch]$purgeold,
117 | [Parameter(Mandatory=$false)]$backupcount
118 |
119 | )
120 |
121 | ###########################################################################
122 |
123 | #$pass=Get-Content $passwordFileLocation | ConvertTo-SecureString
124 |
125 | #use key and password to create local secure password
126 | $AESKey = Get-Content -Path $ASEKeyFileLocation
127 | $pwdTxt = Get-Content -Path $passwordFileLocation
128 | $securePass = $pwdTxt | ConvertTo-SecureString -Key $AESKey
129 |
130 | ## login Function ##
131 |
132 | function connect-ProfileUnityServer{
133 | ##Ignore-SSL Library Code
134 | add-type @"
135 | using System.Net;
136 | using System.Security.Cryptography.X509Certificates;
137 | public class TrustAllCertsPolicy : ICertificatePolicy {
138 | public bool CheckValidationResult(
139 | ServicePoint srvPoint, X509Certificate certificate,
140 | WebRequest request, int certificateProblem) {
141 | return true;
142 | }
143 | }
144 | "@
145 | [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
146 |
147 | ##Get Creds
148 | #[string]$global:servername= Read-Host -Prompt 'FQDN of ProfileUnity Server Name'
149 |
150 | $pass2=[Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($securepass))
151 |
152 | #Connect to Server
153 | Write-host "Logging into ProfileUnity Server"
154 | Invoke-WebRequest https://"$servername":8000/authenticate -Body "username=$user&password=$pass2" -Method Post -SessionVariable session
155 | $global:session=$session
156 | }
157 |
158 | ##########################
159 |
160 | Connect-ProfileUnityServer
161 | Start-Sleep -Seconds 2
162 |
163 |
164 |
165 | #Start Backup
166 | Write-Host "Starting backup"
167 | try {
168 | Invoke-restmethod "https://$($servername):8000/api/database/backup" -WebSession $session -Method GET|Out-Null
169 | }
170 | catch {
171 | throw $_
172 | }
173 |
174 | #Get list of backups
175 | $PUBL = Invoke-restmethod "https://$($servername):8000/api/database/backup/list" -WebSession $session
176 | #Get newest backup ID
177 | $PUBID = $publ.Tag|Sort-Object created -Descending|Select-Object -First 1
178 |
179 | #Wait for latest backup to finish
180 | if($PUBID.State -eq "Processing")
181 | {
182 | do{
183 | write-host "Waiting for backup to complete..."
184 | Start-Sleep -Seconds 3
185 | #getlist
186 | $PUBL = Invoke-restmethod "https://$($servername):8000/api/database/backup/list" -WebSession $session
187 | #Get newest backup ID
188 | $PUBID = $publ.Tag|Sort-Object created -Descending|Select-Object -First 1
189 | }
190 | until($PUBID.State -eq "Success")
191 |
192 | }
193 |
194 | #Download backup
195 | Write-Host "Downloading $($PUBID.Filename)"
196 | try {
197 | Invoke-WebRequest "https://$($servername):8000/api/database/backup/$($PUBID.id)" -WebSession $session -OutFile "$savepath\$($PUBID.Filename)"|Out-Null
198 | }
199 | catch
200 | {
201 | throw $_
202 | }
203 |
204 |
205 | #Purge previous backups
206 | if($purgeold)
207 | {
208 | #Check for local backup copy amounts
209 | $localbackups = Get-ChildItem -Path $savepath -Filter "*.zip"
210 |
211 | if($localbackups.count -gt $backupcount)
212 | {
213 | write-host "Purging extra local backups"
214 | $localbackups|Sort-Object name -Descending|Select-Object -Last ($localbackups.Count - $backupcount)|Remove-Item -Force
215 | }
216 |
217 |
218 | }
219 |
220 |
221 | ````
222 |
223 |
224 |
225 |
226 | | OS Version | Verified |
227 | | ------------- | ------------- |
228 | |Windows 10 | Yes |
229 | |Windows 2019 | Yes |
230 | |Windows 2016 | Yes |
231 | |Windows Server 2012 | No |
232 | |Windows Server 2012 R2 | Yes |
233 | |Windows 8 | No |
234 | |Windows 7 | Yes |
--------------------------------------------------------------------------------
/PowerTools/ProfileUnity Backup/Retired - Backup DBv1.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/PowerTools/ProfileUnity Backup/Retired - Backup DBv1.zip
--------------------------------------------------------------------------------
/PowerTools/ProfileUnity Backup/Retired - BackupDBv3.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/PowerTools/ProfileUnity Backup/Retired - BackupDBv3.zip
--------------------------------------------------------------------------------
/PowerTools/ProfileUnity Filter Creation from Template/Creating a Filter.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/PowerTools/ProfileUnity Filter Creation from Template/Creating a Filter.pdf
--------------------------------------------------------------------------------
/PowerTools/ProfileUnity Filter Creation from Template/ProfileUnity Filter Creation from Templatev2.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/PowerTools/ProfileUnity Filter Creation from Template/ProfileUnity Filter Creation from Templatev2.zip
--------------------------------------------------------------------------------
/PowerTools/ProfileUnity Filter Creation from Template/ProfileUnity Filter Creation from Templatev4.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/PowerTools/ProfileUnity Filter Creation from Template/ProfileUnity Filter Creation from Templatev4.zip
--------------------------------------------------------------------------------
/PowerTools/ProfileUnity Filter Creation from Template/ReadMe.MD:
--------------------------------------------------------------------------------
1 | ## ProfileUnity Backup
2 |
3 | **Description**
4 | This Is a powershell script that will pull filter options from a CSV and input them into the ProfileUnity Web Console.
5 |
6 | **How to Use**
7 |
8 | **Prerequisites**
9 | This was built on the latest version of PowerShell.
10 | https://www.microsoft.com/en-us/download/details.aspx?id=50395
11 |
12 | Download Zip with Script
13 | https://github.com/liquidwarelabs/ProfileUnity/raw/master/PowerTools/ProfileUnity%20Filter%20Creation%20from%20Template/ProfileUnity%20Filter%20Creation%20from%20Templatev4.zip
14 |
15 | **To load**
16 |
17 | - **copy the PS1 down into a folder on the profileunity server.**
18 | - **Edit the CSV with the items needed**
19 | - 1. Follow guide to set the fields correctly.
20 | - 2. https://github.com/liquidwarelabs/ProfileUnity/blob/master/PowerTools/ProfileUnity%20Filter%20Creation%20from%20Template/Creating%20a%20Filter.pdf
21 |
22 | - **In PowerShell type**:
23 | ````
24 | Run “New-Filter.ps1”
25 | Follow prompts
26 | ````
27 | - **If you get an Execution Policy error.**
28 | ````
29 | Set-ExecutionPolicy -ExecutionPolicy Unrestricted
30 | ````
31 |
32 |
33 | Script Code New-Filter.ps1:
34 | ````
35 | ##login Function
36 |
37 | function connect-ProfileUnityServer{
38 | ##Ignore-SSL Library Code
39 | add-type @"
40 | using System.Net;
41 | using System.Security.Cryptography.X509Certificates;
42 | public class TrustAllCertsPolicy : ICertificatePolicy {
43 | public bool CheckValidationResult(
44 | ServicePoint srvPoint, X509Certificate certificate,
45 | WebRequest request, int certificateProblem) {
46 | return true;
47 | }
48 | }
49 | "@
50 | [System.Net.ServicePointManager]::CertificatePolicy = New-Object TrustAllCertsPolicy
51 |
52 | ##Get Creds
53 | [string]$global:servername= Read-Host -Prompt 'FQDN of ProfileUnity Server Name'
54 | $user = Read-Host "Enter Username"
55 | $pass = Read-Host -assecurestring "Enter Password"
56 | $pass2=[Runtime.InteropServices.Marshal]::PtrToStringAuto([Runtime.InteropServices.Marshal]::SecureStringToBSTR($pass))
57 |
58 | #Connect to Server
59 | Invoke-WebRequest https://"$servername":8000/authenticate -Body "username=$user&password=$pass2" -Method Post -SessionVariable session
60 | $global:session=$session
61 | }
62 |
63 | Function Get-FileName($CSV)
64 | {
65 | [System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") |
66 | Out-Null
67 |
68 | $OpenFileDialog = New-Object System.Windows.Forms.OpenFileDialog
69 | $OpenFileDialog.initialDirectory = $initialDirectory
70 | $OpenFileDialog.filter = "All files (*.*)| *.*"
71 | $OpenFileDialog.ShowDialog() | Out-Null
72 | $OpenFileDialog.filename
73 | } #end function Get-FileName
74 |
75 | connect-ProfileUnityServer
76 |
77 | $ListCSVFile=Get-FileName
78 | $lists=import-csv $ListCSVFile
79 |
80 | Foreach ($item in $lists){
81 | #FilterRules Hashing
82 | $FilterRules=@{ConditionType=$item.FilterConditionType; MatchType=$item.FilterMatchType; Value=$item.Filtervalue}
83 | $FilterRules=@($FilterRules)
84 |
85 | ##Make New FilterSettings
86 | $newFilter=[pscustomobject]@{
87 | Name=$item.Name;
88 | Comments=$item.Comments;
89 | RuleAggregate=$item.RuleAggregate;
90 | FilterRules=$FilterRules;
91 | MachineClasses=$item.MachineClasses;
92 | OperatingSystems=$item.OperatingSystems;
93 | SystemEvents=$item.SystemEvents;
94 | Connections=$item.Connections;
95 | }
96 | Invoke-WebRequest https://"$servername":8000/api/filter -ContentType "application/json" -Method Post -WebSession $session -Body($NewFilter | ConvertTo-Json -Depth 10)
97 |
98 | }
99 |
100 |
101 | ````
102 |
103 |
104 |
105 |
106 | | OS Version | Verified |
107 | | ------------- | ------------- |
108 | |Windows 10 | Yes |
109 | |Windows 2019 | Yes |
110 | |Windows 2016 | Yes |
111 | |Windows Server 2012 | No |
112 | |Windows Server 2012 R2 | Yes |
113 | |Windows 8 | No |
114 | |Windows 7 | Yes |
115 |
--------------------------------------------------------------------------------
/PowerTools/ProfileUnity Restore From Retention/ReadMe.MD:
--------------------------------------------------------------------------------
1 | ## ProfileUnity Portability Restore
2 |
3 | **Description**
4 | This is a powershell script that is a GUI for profile restore from the fileshare.
5 |
6 | **How to Use**
7 | Modify the line with your share info $usershare="\\SERVER\ProfileShare"
8 | Run powershell, follow prompts. This restores all portaibity archives
9 |
10 | **Prerequisites**
11 | This was built on the latest version of PowerShell.
12 | https://www.microsoft.com/en-us/download/details.aspx?id=50395
13 |
14 |
15 | - **In PowerShell type**:
16 | ````
17 | Run “restoreRetentionv4.ps1”
18 | Follow prompts
19 | ````
20 | - **If you get an Execution Policy error.**
21 | ````
22 | Set-ExecutionPolicy -ExecutionPolicy Unrestricted
23 | ````
24 |
25 |
26 | Script Code restoreRetentionv4.ps1:
27 | ````
28 | $t = '[DllImport("user32.dll")] public static extern bool ShowWindow(int handle, int state);'
29 | add-type -name win -member $t -namespace native
30 | [native.win]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0)
31 |
32 | [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
33 |
34 | # Show input box popup and return the value entered by the user.
35 | function Read-InputBoxDialog([string]$Message, [string]$WindowTitle, [string]$DefaultText)
36 | {
37 | Add-Type -AssemblyName Microsoft.VisualBasic
38 | return [Microsoft.VisualBasic.Interaction]::InputBox($Message, $WindowTitle, $DefaultText)
39 | }
40 |
41 |
42 | $usershare="\\SERVER\ProfileShare"
43 | #$username = Read-host -Prompt 'input users username'
44 | $username = Read-InputBoxDialog -Message "Please enter the username for your selected user'" -WindowTitle "Select User" -DefaultText "jsmith"
45 |
46 | if ($username -eq "") { Write-Host "You clicked Cancel" }
47 |
48 | elseif ($username -ne $null)
49 |
50 | { $selection = Get-ChildItem $usershare\$username\portability\Retention -Directory
51 |
52 | $selection = $selection | out-gridview -Title "Please Select a Restore Point" -passthru
53 |
54 | $OUTPUT= [System.Windows.Forms.MessageBox]::Show("Are you sure you would like to restore $selection for $username." , "Status" , 4)
55 | if ($OUTPUT -eq "YES" )
56 |
57 | {
58 | Copy $usershare\$username\portability\win10\Retention\$selection.Name\*.* $usershare\$username\portability\win10\
59 | Copy $usershare\$username\portability\win7\Retention\$selection.Name\*.* $usershare\$username\portability\win7\
60 | Copy $usershare\$username\portability\Retention\$selection.Name\*.* $usershare\$username\portability\
61 | Remove-Item -Path $usershare\$username\portability\*.manifest -Confirm:$false -Force
62 | Remove-Item -Path $usershare\$username\portability\Win10\*.manifest -Confirm:$false -Force
63 | Remove-Item -Path $usershare\$username\portability\Win7\*.manifest -Confirm:$false -Force
64 | }
65 | else
66 |
67 | {
68 | exit
69 | }
70 |
71 | }
72 |
73 |
74 | ````
75 |
76 |
77 |
78 |
79 | | OS Version | Verified |
80 | | ------------- | ------------- |
81 | |Windows 10 | Yes |
82 | |Windows 2019 | Yes |
83 | |Windows 2016 | Yes |
84 | |Windows Server 2012 | No |
85 | |Windows Server 2012 R2 | Yes |
86 | |Windows 8 | No |
87 | |Windows 7 | Yes |
--------------------------------------------------------------------------------
/PowerTools/ProfileUnity Restore From Retention/restoreRetentionv4.ps1:
--------------------------------------------------------------------------------
1 | $t = '[DllImport("user32.dll")] public static extern bool ShowWindow(int handle, int state);'
2 | add-type -name win -member $t -namespace native
3 | [native.win]::ShowWindow(([System.Diagnostics.Process]::GetCurrentProcess() | Get-Process).MainWindowHandle, 0)
4 |
5 | [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
6 |
7 | # Show input box popup and return the value entered by the user.
8 | function Read-InputBoxDialog([string]$Message, [string]$WindowTitle, [string]$DefaultText)
9 | {
10 | Add-Type -AssemblyName Microsoft.VisualBasic
11 | return [Microsoft.VisualBasic.Interaction]::InputBox($Message, $WindowTitle, $DefaultText)
12 | }
13 |
14 |
15 | $usershare="\\SERVER\ProfileShare"
16 | #$username = Read-host -Prompt 'input users username'
17 | $username = Read-InputBoxDialog -Message "Please enter the username for your selected user'" -WindowTitle "Select User" -DefaultText "jsmith"
18 |
19 | if ($username -eq "") { Write-Host "You clicked Cancel" }
20 |
21 | elseif ($username -ne $null)
22 |
23 | { $selection = Get-ChildItem $usershare\$username\portability\Retention -Directory
24 |
25 | $selection = $selection | out-gridview -Title "Please Select a Restore Point" -passthru
26 |
27 | $OUTPUT= [System.Windows.Forms.MessageBox]::Show("Are you sure you would like to restore $selection for $username." , "Status" , 4)
28 | if ($OUTPUT -eq "YES" )
29 |
30 | {
31 | Copy $usershare\$username\portability\win10\Retention\$selection.Name\*.* $usershare\$username\portability\win10\
32 | Copy $usershare\$username\portability\win7\Retention\$selection.Name\*.* $usershare\$username\portability\win7\
33 | Copy $usershare\$username\portability\Retention\$selection.Name\*.* $usershare\$username\portability\
34 | Remove-Item -Path $usershare\$username\portability\*.manifest -Confirm:$false -Force
35 | Remove-Item -Path $usershare\$username\portability\Win10\*.manifest -Confirm:$false -Force
36 | Remove-Item -Path $usershare\$username\portability\Win7\*.manifest -Confirm:$false -Force
37 | }
38 | else
39 |
40 | {
41 | exit
42 | }
43 |
44 | }
--------------------------------------------------------------------------------
/SE Field Articles/BootEnvVar.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/SE Field Articles/BootEnvVar.pdf
--------------------------------------------------------------------------------
/SE Field Articles/Local profileUnity Install.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/SE Field Articles/Local profileUnity Install.pdf
--------------------------------------------------------------------------------
/SE Field Articles/ProfileUnity 2012 GPO Creation.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/SE Field Articles/ProfileUnity 2012 GPO Creation.pdf
--------------------------------------------------------------------------------
/SE Field Articles/readme.md:
--------------------------------------------------------------------------------
1 | What are the SE Field Articles
2 | --------------
3 | Field SE Articles are written and updated by Liquidware Field Systems Engineeers. The docs, scripts and content are not supported by Liquidware Inc. The articles in this respository are for our clients and partners and offer examples of how ProfileUnity could be used.
4 |
5 | New to ProfileUnity™ ?
6 | ------------------
7 |
8 | If you are new to ProfileUnity™ and would like to learn more, we recommend reviewing the [getting started][] documentation.
9 | There is also [Video Training] you can review as well.
10 |
11 | [getting started]: https://liquidwarelabs.zendesk.com/hc/en-us/articles/210641943-ProfileUnity-with-FlexApp-Documentation-
12 | [Video Training]: http://training.liquidware.com/products/profileunity
13 |
14 | Get ProfileUnity™
15 | --------------
16 |
17 | You can download and install a PowerShell package for any of the following platforms.
18 |
19 | | Downloads |
20 | | ---------------------- |
21 | | [Liquidware Downloads][Downloads] |
22 |
23 |
24 | [Downloads]: http://www.liquidware.com/download
25 | [logo]: https://avatars3.githubusercontent.com/u/24906944?v=3&s=200
26 |
--------------------------------------------------------------------------------
/Scripts/Clean Uninstall-Reinstall/README.md:
--------------------------------------------------------------------------------
1 | # ProfileUnity Client Uninstall-Reinstall
2 |
3 | Description
4 |
5 | Powershell Script cleanly uninstalls and reinstalls profileUnity client
6 |
7 |
8 | How to Use
9 | # Set Path to Current ProfileUnity Client Startup
10 | #code to install
11 | $CurrentVersionPath = "\\SERVER\profileUnity\ClientTools\LwL.ProfileUnity.Client.Startup.exe"
12 | #code to uninstall
13 | $OldVersionPath = "\\SERVER\profileUnity\Clienttools6.8.2\LwL.ProfileUnity.Client.Startup.exe"
14 |
15 | Add this script into your computer startup Powershell GPO.
16 |
17 |
18 |
19 |
20 | Code
21 | ````
22 |
23 | # Set Path to Current ProfileUnity Client Startup
24 | $CurrentVersionPath = "\\SERVER\profileUnity\ClientTools\LwL.ProfileUnity.Client.Startup.exe"
25 | $OldVersionPath = "\\SERVER\profileUnity\Clienttools6.8.2\LwL.ProfileUnity.Client.Startup.exe"
26 |
27 |
28 | # Check Client Install
29 | $uninstall64 = Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | ForEach-Object { Get-ItemProperty $_.PSPath } | ? { $_ -match "ProfileUnity Client" }
30 |
31 | # Version Check
32 | $CurrentVersion = (Get-ItemProperty $CurrentVersionPath).VersionInfo.FileVersion
33 | $VersionCheck = $uninstall64.DisplayVersion -like "*$CurrentVersion*"
34 |
35 | # Uninstall if needed
36 | If ( $VersionCheck -eq "true") {
37 | Write-host "Current ProfileUnity Client Installed"
38 |
39 | break
40 |
41 | } Else {
42 |
43 | Write-Output "Uninstalling ProfileUnity Client..."
44 | start-process $OldVersionPath -ArgumentList "/uninstall" -Wait
45 | Write-Output "Removing Leftover Registery Items..."
46 | Remove-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Liquidware Labs" -Recurse
47 | Remove-Item -Path "HKLM:\SOFTWARE\Liquidware Labs" -Recurse
48 |
49 | if( ( (test-path "HKLM:\SOFTWARE\WOW6432Node\Liquidware Labs","HKLM:\SOFTWARE\Liquidware Labs","C:\Program Files\ProfileUnity") -eq $false).Count ){
50 | Write-host "ProfileUnity Uninstalled"
51 | Write-host "Installing Current ProfileUnity Client"
52 | start-process $CurrentVersionPath -arg "/WaitOnExit false" -wait
53 | Write-host "Rebooting Workstation"
54 | Restart-Computer
55 | }Else
56 | {
57 | Write-host "Uninstall failed..."
58 | break
59 | }
60 | }
61 | exit
62 |
63 | ````
64 |
65 |
66 |
67 | | OS Version | Verified |
68 | | ------------- | ------------- |
69 | |Windows 10 | YES |
70 | |Windows Server 2019 | YES |
71 | |Windows Server 2016 | YES |
72 | |Windows Server 2012 | YES |
73 | |Windows Server 2012 R2 | YES |
--------------------------------------------------------------------------------
/Scripts/Clean Uninstall-Reinstall/uninstallClient-reinstall.ps1:
--------------------------------------------------------------------------------
1 |
2 | # Set Path to Current ProfileUnity Client Startup
3 | $CurrentVersionPath = "\\SERVER\profileUnity\ClientTools\LwL.ProfileUnity.Client.Startup.exe"
4 | $OldVersionPath = "\\SERVER\profileUnity\Clienttools6.8.2\LwL.ProfileUnity.Client.Startup.exe"
5 |
6 |
7 | # Check Client Install
8 | $uninstall64 = Get-ChildItem "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" | ForEach-Object { Get-ItemProperty $_.PSPath } | ? { $_ -match "ProfileUnity Client" }
9 |
10 | # Version Check
11 | $CurrentVersion = (Get-ItemProperty $CurrentVersionPath).VersionInfo.FileVersion
12 | $VersionCheck = $uninstall64.DisplayVersion -like "*$CurrentVersion*"
13 |
14 | # Uninstall if needed
15 | If ( $VersionCheck -eq "true") {
16 | Write-host "Current ProfileUnity Client Installed"
17 |
18 | break
19 |
20 | } Else {
21 |
22 | Write-Output "Uninstalling ProfileUnity Client..."
23 | start-process $OldVersionPath -ArgumentList "/uninstall" -Wait
24 | Write-Output "Removing Leftover Registery Items..."
25 | Remove-Item -Path "HKLM:\SOFTWARE\WOW6432Node\Liquidware Labs" -Recurse
26 | Remove-Item -Path "HKLM:\SOFTWARE\Liquidware Labs" -Recurse
27 |
28 | if( ( (test-path "HKLM:\SOFTWARE\WOW6432Node\Liquidware Labs","HKLM:\SOFTWARE\Liquidware Labs","C:\Program Files\ProfileUnity") -eq $false).Count ){
29 | Write-host "ProfileUnity Uninstalled"
30 | Write-host "Installing Current ProfileUnity Client"
31 | start-process $CurrentVersionPath -arg "/WaitOnExit false" -wait
32 | Write-host "Rebooting Workstation"
33 | Restart-Computer
34 | }Else
35 | {
36 | Write-host "Uninstall failed..."
37 | break
38 | }
39 | }
40 | exit
--------------------------------------------------------------------------------
/Scripts/Create Local GPO/LocalGPOv2.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/Scripts/Create Local GPO/LocalGPOv2.zip
--------------------------------------------------------------------------------
/Scripts/Create Local GPO/README.md:
--------------------------------------------------------------------------------
1 | # Create Local ProfileUnity GPO
2 |
3 | Description
4 | Automatically creates Local GPO for ProfileUnity
5 | V2 Update: Updated LGPO to 2.2, Changed Logoff to local
6 |
7 | Attached in this repository is:
8 | LocalGPO.Zip [LocalGPO.zip][localgpozip]
9 |
10 | In the Zip Archive is:
11 |
12 | ````
13 | ADM
14 | GPT.ini
15 | ProfileUnity.adm
16 | EditME
17 | ProUsettings.txt
18 | scripts.ini
19 | Items
20 | AddLocalGPO.bat
21 | LGPO.exe
22 | LocalInstallProU.bat
23 | ````
24 |
25 | How to Use
26 | Edit the Items in "EditMe"
27 | ProUsettings.txt
28 |
29 | Edit "EDITME" items in ProUsettings.txt to point to the user INI path
30 | ````
31 | User
32 | SOFTWARE\Liquidware Labs\ProfileUnity
33 | INIPath
34 | SZ:\\\\EDITME\\profileunity\\user
35 | ````
36 |
37 | Edit "EDITME" items in "LocalInstallProU.bat" to point to the distro path
38 | ````
39 | xcopy /s \\EDITME\LocalGPO\* %temp%\LocalGPO\
40 | REM Optional Install of ProfileUnity client
41 | REM %systemroot%\system32\cmd.exe /c \\EDITME\profileunity\clienttools\LwL.ProfileUnity.Client.Startup.exe
42 | ````
43 |
44 | Once Edited Run "LocalInstallProU.bat" as administrator on the local machine. This will copy the directory into the local "temp" folder and run from there.
45 |
46 | Side notes:
47 | If you don't see the logoff script on your configuration, Edit the version number to a higher number. Then rerun the script:
48 | ````
49 | ADM
50 | GPT.ini
51 |
52 | Version=300000
53 | ````
54 |
55 |
56 | [localgpozip]: https://github.com/liquidwarelabs/ProfileUnity/raw/master/Scripts/Create%20Local%20GPO/LocalGPOv2.zip
57 |
58 |
59 |
60 | | OS Version | Verified |
61 | | ------------- | ------------- |
62 | |Windows 10 | YES |
63 | |Windows Server 2012 | NO |
64 | |Windows Server 2012 R2 | NO |
65 | |Windows Server 2008 R2 | NO |
66 | |Windows Server 2008 | NO |
67 | |Windows Server 2003 | No |
68 | |Windows 8 | NO |
69 | |Windows 7 | YES |
70 | |Windows Vista | No |
71 | |Windows XP | No |
72 | |Windows 2000 | No |
73 |
--------------------------------------------------------------------------------
/Scripts/Modern App Selection/Fix-Start.reg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/Scripts/Modern App Selection/Fix-Start.reg
--------------------------------------------------------------------------------
/Scripts/Modern App Selection/Fix-Start.reg.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/liquidwarelabs/ProfileUnity/d179e39d9702bfd5fde472a61470180dbf606628/Scripts/Modern App Selection/Fix-Start.reg.txt
--------------------------------------------------------------------------------
/Scripts/Modern App Selection/ProcessAppX.ps1:
--------------------------------------------------------------------------------
1 | # Set log time
2 | $datetime=get-date -format "mmddyyyyHHMMss"
3 | #Add apps you want to process in the first line
4 | $appxs="Microsoft.Windows.Cortana,Microsoft.Windows.ShellExperienceHost,windows.immersivecontrolpanel,Microsoft.WindowsCalculator,Microsoft.Windows.Photos"
5 | $appxs=$appxs.Split(",")
6 | foreach ($appx in $appxs) {
7 | Get-AppXPackage -AllUsers -name *$appx* | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"; $_ } | Out-File "$env:temp\$datetime-LW-AppXPackage.log" -append
8 | }
--------------------------------------------------------------------------------
/Scripts/Modern App Selection/ReadMe.MD:
--------------------------------------------------------------------------------
1 | # Selectively choose which Modern apps to load
2 |
3 | Description
4 | Powershell script to Selectively load which modern apps you want to load for new user logins
5 |
6 | How to Use
7 |
8 | Disable appreadiness services in your master image, use Start-fix.reg keys if Optimization tool breaks startmenu registration or do not disable the privacy options in your optimization.
9 |
10 | Set the execution policy
11 |
12 | ```
13 | Set-ExecutionPolicy -ExecutionPolicy Unrestricted
14 | ```
15 | Run Script
16 |
17 | Run this command with admin rights to get the app name listings
18 |
19 | ````
20 | Get-AppxPackage -allusers | select name
21 | ````
22 |
23 | Select which apps you want to add back to the user, then modify first line of powershell script with apps you want to add.
24 |
25 | ````
26 | $appxs="Microsoft.AAD.BrokerPlugin,Microsoft.Windows.Cortana,Microsoft.Windows.ShellExperienceHost,Microsoft.Windows.StartMenuExperienceHost,microsoft.accountscontrol"
27 | ````
28 |
29 | ````
30 | Make AppLauncher Rule
31 | %systemroot%\system32\cmd.exe
32 | /c powershell.exe -executionpolicy bypass \\path\Scripts\ProcessAppX.ps1
33 | After Config
34 | Run Asyn
35 | ````
36 |
37 |
38 | Code
39 | ProcessAppX.ps1
40 | ````
41 | #Add apps you want to process in the first line
42 | $appxs="Microsoft.MicrosoftEdge,Microsoft.Windows.ShellExperienceHost,Microsoft.Windows.Cortana,windows.immersivecontrolpanel"
43 | $appxs=$appxs.Split(",")
44 | foreach ($appx in $appxs) {
45 | Get-AppXPackage -AllUsers -name *$appx* | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register "$($_.InstallLocation)\AppXManifest.xml"}
46 | }
47 |
48 | ````
49 |
50 |
51 |
52 | | OS Version | Verified |
53 | | ------------- | ------------- |
54 | |Windows 10 21H1 | YES |
55 | |Windows 10 20H1/2 | YES |
56 | |Windows 10 1903/9 | YES |
57 | |Windows 10 1803/9 | YES |
58 | |Windows 10 1703/9 | YES |
59 | |Windows 10 1607 | YES |
60 |
--------------------------------------------------------------------------------
/Scripts/ProfileUnityClientTools_686R1_SilentInstall.ps1:
--------------------------------------------------------------------------------
1 | ##########################################################################################################################################################################
2 | # ProfileUnity 6.8.5 and up has built-in caching support for all required files
3 | # After one "on-network" login as a production user, ProfileUnity is then ready to function offline
4 |
5 | # UserINIPath AND LicenseServerConnectionString ARE REQUIRED!
6 | # Update at least the first 2 variables with your own environment and storage information
7 | $UserINIPath = "\\some.server\somewhere\ProfileUnity" # or "AZ://blob/folder" or "S3://blob/folder" or "GS://blob/folder"
8 | # Copy License Server Connection String from the ProfileUnity Console Administration screen, Client Settings section, click Manage Connection Strings and click the Copy to Clipboard button
9 | $LicenseServerConnectionString = ""
10 |
11 | # Optional settings based on environmental requirements - Defaults included, if any
12 | $SystemINIPath = "$UserINIPath\Startup"
13 | $ClientServiceExeCredsPath = "$UserINIPath"
14 | $ProfileDiskConfigNodesXmlPath = "$UserINIPath"
15 | $SecondaryPaths = ""
16 | # Client Cloud credentials can be copied from the ProfileUnity Console Administration screen - Client creds, NOT Console!
17 | $AzureStorageCredentials = ""
18 | $SecondaryAzureStorageCredentials = ""
19 | $AmazonS3Credentials = ""
20 | $GoogleStorageCredentials = ""
21 | # Comment out the CloudToolsInstallerPS1 value if you want to skip the ProfileUnity client-tools installation
22 | $CloudToolsInstallerPS1 = "https://cdn.liquidware.com/6.8.6/ProfileUnity-CloudInstall_6.8.6r1ga3.ps1"
23 |
24 | #################################################################################################################################################
25 | # To skip running ProfileUnity and FlexApp for your local admin account, define the name of your local admin account here.
26 | $localAdminUser = "admin"
27 | # To skip for a service account, specify here.
28 | $installerServiceAccount = "administrator"
29 | # List of "Users" (read: folders in C:\Users) to be excluded from reg settings
30 | $excludedUsers = @(
31 | $env:computername+'$'
32 | $installerServiceAccount
33 | $localAdminUser
34 | "Default"
35 | "Public"
36 | )
37 | #################################################################################################################################################
38 | # Uncomment this setting to skip the configuration of the logoff script GPO, If desired, to reduce logoff times - ONLY SPECIAL SCENARIOS!
39 | # ONLY USE FOR FlexApp-ONLY DEPLOYMENTS TO NON-PERSISTENT MACHINES OR FlexAppOne-ONLY DEPLOYMENTS TO PERSISTENT OR NON-PERSISTENT MACHINES!
40 | # $SkipLogoffGPO = $true
41 | #################################################################################################################################################
42 | Start-Transcript -Path "C:\windows\temp\lwinstallerlog.txt" -Append
43 |
44 | # Define function to update HKCU for all existing profiles, including default user and logged on user
45 | function Add-AllUserRegSetting {
46 | [CmdletBinding()]
47 | param (
48 | [string]$RegPath,
49 | [string]$PropertyName,
50 | $PropertyValue,
51 | [Parameter(Mandatory=$true)][ValidateSet('String','ExpandString','Binary','DWord','MultiString','Qword','Unknown')][string]$PropertyType,
52 | [Parameter(Mandatory=$false)][string]$DefaultUserMountPoint
53 | )
54 |
55 | begin {
56 | $StrippedPath = ($RegPath -split 'HKCU:\\')[1]
57 | $loggedOnUsers = (Get-WmiObject Win32_Process -f 'Name="explorer.exe"' |% getowner |% user | Where-Object { ($_ -notin $excludedUsers) })
58 | Write-Host
59 | Write-Host "Setting value $PropertyName"
60 | }
61 |
62 | process {
63 | #Current user settings, if not an excluded user.
64 | if ($env:username -notin $excludedUsers) {
65 | if (!(Test-Path -Path $RegPath )) {
66 | $Item = New-Item -Path $RegPath -Force
67 | $Item.Handle.Close()
68 | }
69 | Write-Host "Current user $env:username being setup..."
70 | New-ItemProperty -Path $RegPath -Name $PropertyName -Value $PropertyValue -PropertyType $PropertyType -Force | Out-Null
71 | Write-Host
72 | }
73 | #DefaultUser settings (if defaultusermountpoint param is specified)
74 | if ($DefaultUserMountPoint){
75 | if (!(Test-Path -Path (Join-Path -Path $DefaultUserMountPoint -ChildPath $StrippedPath) )) {
76 | $Item = New-Item -Path (Join-Path -Path $DefaultUserMountPoint -ChildPath $StrippedPath) -Force
77 | $Item.Handle.Close()
78 | }
79 | Write-Host "Default user being setup..."
80 | New-ItemProperty -Path (Join-Path -Path $DefaultUserMountPoint -ChildPath $StrippedPath) -Name $PropertyName -Value $PropertyValue -PropertyType $PropertyType -Force | Out-Null
81 | Write-Host
82 | }
83 |
84 | #Existing users NOT logged on to machine that aren't excluded
85 | $users = (Get-ChildItem -Path c:\users | Where-Object { (($_.Name -notin $excludedUsers) -and ($_.Name -notin $loggedOnUsers) -and ($_.Name -ne $env:username)) }).Name
86 | $users
87 | ForEach ($user in $users) {
88 | Write-Host "Starting logged off user $user"
89 | reg load "HKLM\$user" "C:\Users\$user\NTUSER.DAT"
90 | $UserRegPath = Join-Path -Path "HKLM:\$user" -ChildPath $StrippedPath
91 | if (!(Test-Path -Path $UserRegPath )) {
92 | $Item = New-Item -Path $UserRegPath -Force
93 | $Item.Handle.Close()
94 | }
95 | New-ItemProperty -Path $UserRegPath -Name $PropertyName -Value $PropertyValue -PropertyType $PropertyType -Force | Out-Null
96 | Set-Location c:\
97 | Start-Sleep -Milliseconds 500
98 | [gc]::collect()
99 | Start-Sleep -Seconds 1
100 | reg unload "HKLM\$user"
101 | Write-Host "Done with logged off user $user"
102 | Write-Host
103 | }
104 |
105 | #Logged On Users that aren't the current user and aren't excluded
106 | $mountedhives = (Get-ItemProperty 'Registry::HKEY_USERS\*\Volatile Environment' -Name USERNAME -ErrorAction SilentlyContinue | Where-Object { (($_.USERNAME -notin $excludedUsers) -and ($_.USERNAME -ne $env:username)) }).PSParentPath
107 | $mountedhives
108 | Write-Host ($mountedhives).count mounted user hives found.
109 | ($loggedOnUsers | Where-Object { ($_ -ne $env:username) })
110 | Write-Host ($loggedOnUsers | Where-Object { ($_ -ne $env:username) }).count logged on users found. These numbers should match!
111 | ForEach ($hive in $mountedhives) {
112 | $user = (Get-ItemProperty "$hive\Volatile Environment" -Name USERNAME -ErrorAction SilentlyContinue).USERNAME
113 | Write-Host "Starting logged on user $user"
114 | $path = (Join-Path -Path $hive -ChildPath "SOFTWARE\Liquidware Labs\ProfileUnity")
115 | if (!(Test-Path -Path $path )) {
116 | $Item = New-Item -Path $path -Force
117 | }
118 | Write-Host "KEY: $path"
119 | New-ItemProperty -Path $path -Name $PropertyName -Value $PropertyValue -PropertyType $PropertyType -Force | Out-Null
120 | Write-Host "Done with logged on user $user"
121 | Write-Host
122 | }
123 | }
124 |
125 | end {
126 | Write-Host "Done setting value $PropertyName"
127 | Write-Host
128 | }
129 | }
130 |
131 | # Set HKLM reg values
132 | Write-Host "Start writing local machine registry keys..." -ForegroundColor GREEN
133 | $MachineREG_ProU = "HKLM:\SOFTWARE\Liquidware Labs\ProfileUnity"
134 | if (!(Test-Path -Path $MachineREG_ProU )) {
135 | $Item = New-Item -Path $MachineREG_ProU -Force
136 | $Item.Handle.Close()
137 | }
138 | If ($AzureStorageCredentials) { New-ItemProperty -Path $MachineREG_ProU -Name AzureStorageCredentials -PropertyType String -Value $AzureStorageCredentials -Force | Out-Null }
139 | If ($SecondaryAzureStorageCredentials) { New-ItemProperty -Path $MachineREG_ProU -Name SecondaryAzureStorageCredentials -PropertyType String -Value $SecondaryAzureStorageCredentials -Force | Out-Null }
140 | If ($AmazonS3Credentials) { New-ItemProperty -Path $MachineREG_ProU -Name AmazonS3Credentials -PropertyType String -Value $AmazonS3Credentials -Force | Out-Null }
141 | If ($GoogleStorageCredentials) { New-ItemProperty -Path $MachineREG_ProU -Name GoogleStorageCredentials -PropertyType String -Value $GoogleStorageCredentials -Force | Out-Null }
142 | If ($SecondaryPaths) { New-ItemProperty -Path $MachineREG_ProU -Name SecondaryPaths -PropertyType String -Value $SecondaryPaths -Force | Out-Null }
143 | If ($ClientServiceExeCredsPath) { New-ItemProperty -Path $MachineREG_ProU -Name ClientServiceExeCredsPath -PropertyType String -Value $ClientServiceExeCredsPath -Force | Out-Null }
144 | If ($SystemINIPath) { New-ItemProperty -Path $MachineREG_ProU -Name INIPath -PropertyType String -Value $SystemINIPath -Force | Out-Null }
145 | If ($LicenseServerConnectionString) { New-ItemProperty -Path $MachineREG_ProU -Name LicenseServerConnectionString -PropertyType String -Value $LicenseServerConnectionString -Force | Out-Null }
146 | If ($ProfileDiskConfigNodesXmlPath) { New-ItemProperty -Path $MachineREG_ProU -Name ProfileDiskConfigNodesXmlPath -PropertyType String -Value $ProfileDiskConfigNodesXmlPath -Force | Out-Null }
147 | Write-Host "Finished writing local machine registry keys." -ForegroundColor GREEN
148 | Write-Host
149 |
150 | # Set HKCU reg values for Default user hive, current logged-on user and all other existing user profiles
151 | Write-Host "Start writing HKU registry keys..." -ForegroundColor GREEN
152 |
153 | #Load Default User registry hive
154 | reg load "HKLM\DefaultUser" "C:\Users\Default\NTUSER.DAT"
155 |
156 | #Add Liquidware settings to HKCU path of Default user AND all existing users on machine
157 | Add-AllUserRegSetting -RegPath "HKCU:\SOFTWARE\Liquidware Labs\ProfileUnity" -PropertyName "Enabled" -PropertyValue "1" -PropertyType "String" -DefaultUserMountPoint "HKLM:\DefaultUser"
158 | Add-AllUserRegSetting -RegPath "HKCU:\SOFTWARE\Liquidware Labs\ProfileUnity" -PropertyName "INIPath" -PropertyValue $UserINIPath -PropertyType "String" -DefaultUserMountPoint "HKLM:\DefaultUser"
159 |
160 | #Cleanup
161 | Set-Location c:\
162 | Start-Sleep -Milliseconds 500
163 | [gc]::collect()
164 | Start-Sleep -Seconds 1
165 |
166 | #Unload Default User registry hive
167 | reg unload hklm\DefaultUser
168 |
169 | #################################################################################################################################################
170 | # Fix Old Policy (legacy from previous installers)
171 |
172 | IF(test-path -path "C:\Windows\System32\GroupPolicy\Machine\*.pol"){
173 | Write-Host "Deleting old policy" -ForegroundColor Yellow
174 | Remove-Item -path "C:\Windows\System32\GroupPolicy\GPT.ini" -Force -ErrorAction SilentlyContinue
175 | Remove-Item -path "C:\Windows\System32\GroupPolicy\Machine\*.pol" -Force -ErrorAction SilentlyContinue
176 | Remove-Item -path "C:\Windows\System32\GroupPolicy\User\*.pol" -Force -ErrorAction SilentlyContinue
177 | Remove-Item -path "C:\Windows\System32\GroupPolicy\ADM\*.adm" -Force -ErrorAction SilentlyContinue
178 | }ELSE{
179 | Write-Host "No legacy Policy found" -ForegroundColor Yellow}
180 | Write-Host
181 | #################################################################################################################################################
182 |
183 | # Configure logoff script if SkipLogoffGPO is false
184 | If (!($SkipLogoffGPO)) {
185 | Write-Host "Start writing local logoff script GPO..." -ForegroundColor GREEN
186 | $ScriptsContent = @"
187 |
188 | [Logoff]
189 | 0CmdLine=C:\Program Files\ProfileUnity\Client.NET\LwL.ProfileUnity.Client.Logoff.exe
190 | 0Parameters=
191 | "@
192 |
193 | If (Test-Path "C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini") { Remove-Item -Path "C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini" -Force }
194 | If (!(Test-Path "C:\Windows\System32\GroupPolicy\User\Scripts")) { New-Item -Path "C:\Windows\System32\GroupPolicy\User\Scripts" -ItemType Directory -Force }
195 | $ScriptsContent | Out-File -FilePath "C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini" -Force
196 |
197 | $GptContent = @"
198 | [General]
199 | gPCUserExtensionNames=[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{D02B1F73-3407-48AE-BA88-E8213C6761F1}][{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B66650-4972-11D1-A7CA-0000F87571E3}]
200 | Version=300000
201 | "@
202 |
203 | $GptContent | Out-File -FilePath "C:\Windows\System32\GroupPolicy\gpt.ini" -Force
204 |
205 | & "cmd.exe" "/c" "gpupdate.exe" "/force"
206 | } Else { Write-Host "SkipLogoffGPO is True! Skipping local logoff script GPO." -ForegroundColor GREEN
207 | Write-Host }
208 |
209 | # Last, install and/or reconfigure ProfileUnity Client Tools
210 | If ($CloudToolsInstallerPS1) {
211 | Write-Host "Starting ProfileUnity Cloud Tools Installer..." -ForegroundColor GREEN
212 | (New-Object System.Net.WebClient).DownloadFile($CloudToolsInstallerPS1,$Env:Temp + '\ProfileUnity-CloudInstall.ps1');Invoke-Expression -Command (Join-Path $Env:Temp '\ProfileUnity-CloudInstall.ps1')
213 | Write-Host "Finished ProfileUnity Cloud Tools Installer." -ForegroundColor GREEN
214 | } Else {
215 | Write-Host "No Cloud Tools PS1 specified, skipping ProfileUnity Cloud Tools installation! Attempting to reconfigure by running local Startup.Update.exe instead..." -ForegroundColor GREEN
216 | $StartupUpdate = "C:\Program Files\ProfileUnity\Client.NET\LwL.ProfileUnity.Client.Startup.Update.exe"
217 | If (Test-Path $StartupUpdate) {
218 | Write-Host "Reconfiguring ProfileUnity Client Tools..." -ForegroundColor GREEN
219 | Start-Process "$StartupUpdate" -Wait | Out-Null
220 | Write-Host "ProfileUnity Client Tools have been reconfigured. Done." -ForegroundColor GREEN
221 | } Else { Write-Host "No local ProfileUnity Client Tools installation found! Ending with no tools." -ForegroundColor RED }
222 | }
223 | Write-Host
--------------------------------------------------------------------------------
/Scripts/ProfileUnityClientTools_SettingsOnly.ps1.ps1:
--------------------------------------------------------------------------------
1 | ##########################################################################################################################################################################
2 | # ProfileUnity 6.8.5 and up has built-in caching support for all required files
3 | # After one "on-network" login as a production user, ProfileUnity is then ready to function offline
4 |
5 | # UserINIPath AND LicenseServerConnectionString ARE REQUIRED!
6 | # Update at least the first 2 variables with your own environment and storage information
7 | $UserINIPath = "\\some.server\somewhere\ProfileUnity" # or "AZ://blob/folder" or "S3://blob/folder" or "GS://blob/folder"
8 | # Copy License Server Connection String from the ProfileUnity Console Administration screen, Client Settings section, click Manage Connection Strings and click the Copy to Clipboard button
9 | $LicenseServerConnectionString = ""
10 |
11 | # Optional settings based on environmental requirements - Defaults included, if any
12 | $SystemINIPath = "$UserINIPath\Startup"
13 | $ClientServiceExeCredsPath = "$UserINIPath"
14 | $ProfileDiskConfigNodesXmlPath = "$UserINIPath"
15 | $SecondaryPaths = ""
16 | # Client Cloud credentials can be copied from the ProfileUnity Console Administration screen - Client creds, NOT Console!
17 | $AzureStorageCredentials = ""
18 | $SecondaryAzureStorageCredentials = ""
19 | $AmazonS3Credentials = ""
20 | $GoogleStorageCredentials = ""
21 |
22 | #################################################################################################################################################
23 | # To skip running ProfileUnity and FlexApp for your local admin account, define the name of your local admin account here.
24 | $localAdminUser = "admin"
25 | # To skip for a service account, specify here.
26 | $installerServiceAccount = "administrator"
27 | # List of "Users" (read: folders in C:\Users) to be excluded from reg settings
28 | $excludedUsers = @(
29 | $env:computername+'$'
30 | $installerServiceAccount
31 | $localAdminUser
32 | "Default"
33 | "Public"
34 | )
35 | #################################################################################################################################################
36 | # Uncomment this setting to skip the configuration of the logoff script GPO, If desired, to reduce logoff times - ONLY SPECIAL SCENARIOS!
37 | # ONLY USE FOR FlexApp-ONLY DEPLOYMENTS TO NON-PERSISTENT MACHINES OR FlexAppOne-ONLY DEPLOYMENTS TO PERSISTENT OR NON-PERSISTENT MACHINES!
38 | # $SkipLogoffGPO = $true
39 | #################################################################################################################################################
40 | Start-Transcript -Path "C:\windows\temp\lwinstallerlog.txt" -Append
41 |
42 | # Define function to update HKCU for all existing profiles, including default user and logged on user
43 | function Add-AllUserRegSetting {
44 | [CmdletBinding()]
45 | param (
46 | [string]$RegPath,
47 | [string]$PropertyName,
48 | $PropertyValue,
49 | [Parameter(Mandatory=$true)][ValidateSet('String','ExpandString','Binary','DWord','MultiString','Qword','Unknown')][string]$PropertyType,
50 | [Parameter(Mandatory=$false)][string]$DefaultUserMountPoint
51 | )
52 |
53 | begin {
54 | $StrippedPath = ($RegPath -split 'HKCU:\\')[1]
55 | $loggedOnUsers = (Get-WmiObject Win32_Process -f 'Name="explorer.exe"' |% getowner |% user | Where-Object { ($_ -notin $excludedUsers) })
56 | Write-Host
57 | Write-Host "Setting value $PropertyName"
58 | }
59 |
60 | process {
61 | #Current user settings, if not an excluded user.
62 | if ($env:username -notin $excludedUsers) {
63 | if (!(Test-Path -Path $RegPath )) {
64 | $Item = New-Item -Path $RegPath -Force
65 | $Item.Handle.Close()
66 | }
67 | Write-Host "Current user $env:username being setup..."
68 | New-ItemProperty -Path $RegPath -Name $PropertyName -Value $PropertyValue -PropertyType $PropertyType -Force | Out-Null
69 | Write-Host
70 | }
71 | #DefaultUser settings (if defaultusermountpoint param is specified)
72 | if ($DefaultUserMountPoint){
73 | if (!(Test-Path -Path (Join-Path -Path $DefaultUserMountPoint -ChildPath $StrippedPath) )) {
74 | $Item = New-Item -Path (Join-Path -Path $DefaultUserMountPoint -ChildPath $StrippedPath) -Force
75 | $Item.Handle.Close()
76 | }
77 | Write-Host "Default user being setup..."
78 | New-ItemProperty -Path (Join-Path -Path $DefaultUserMountPoint -ChildPath $StrippedPath) -Name $PropertyName -Value $PropertyValue -PropertyType $PropertyType -Force | Out-Null
79 | Write-Host
80 | }
81 |
82 | #Existing users NOT logged on to machine that aren't excluded
83 | $users = (Get-ChildItem -Path c:\users | Where-Object { (($_.Name -notin $excludedUsers) -and ($_.Name -notin $loggedOnUsers) -and ($_.Name -ne $env:username)) }).Name
84 | $users
85 | ForEach ($user in $users) {
86 | Write-Host "Starting logged off user $user"
87 | reg load "HKLM\$user" "C:\Users\$user\NTUSER.DAT"
88 | $UserRegPath = Join-Path -Path "HKLM:\$user" -ChildPath $StrippedPath
89 | if (!(Test-Path -Path $UserRegPath )) {
90 | $Item = New-Item -Path $UserRegPath -Force
91 | $Item.Handle.Close()
92 | }
93 | New-ItemProperty -Path $UserRegPath -Name $PropertyName -Value $PropertyValue -PropertyType $PropertyType -Force | Out-Null
94 | Set-Location c:\
95 | Start-Sleep -Milliseconds 500
96 | [gc]::collect()
97 | Start-Sleep -Seconds 1
98 | reg unload "HKLM\$user"
99 | Write-Host "Done with logged off user $user"
100 | Write-Host
101 | }
102 |
103 | #Logged On Users that aren't the current user and aren't excluded
104 | $mountedhives = (Get-ItemProperty 'Registry::HKEY_USERS\*\Volatile Environment' -Name USERNAME -ErrorAction SilentlyContinue | Where-Object { (($_.USERNAME -notin $excludedUsers) -and ($_.USERNAME -ne $env:username)) }).PSParentPath
105 | $mountedhives
106 | Write-Host ($mountedhives).count mounted user hives found.
107 | ($loggedOnUsers | Where-Object { ($_ -ne $env:username) })
108 | Write-Host ($loggedOnUsers | Where-Object { ($_ -ne $env:username) }).count logged on users found. These numbers should match!
109 | ForEach ($hive in $mountedhives) {
110 | $user = (Get-ItemProperty "$hive\Volatile Environment" -Name USERNAME -ErrorAction SilentlyContinue).USERNAME
111 | Write-Host "Starting logged on user $user"
112 | $path = (Join-Path -Path $hive -ChildPath "SOFTWARE\Liquidware Labs\ProfileUnity")
113 | if (!(Test-Path -Path $path )) {
114 | $Item = New-Item -Path $path -Force
115 | }
116 | Write-Host "KEY: $path"
117 | New-ItemProperty -Path $path -Name $PropertyName -Value $PropertyValue -PropertyType $PropertyType -Force | Out-Null
118 | Write-Host "Done with logged on user $user"
119 | Write-Host
120 | }
121 | }
122 |
123 | end {
124 | Write-Host "Done setting value $PropertyName"
125 | Write-Host
126 | }
127 | }
128 |
129 | # Set HKLM reg values
130 | Write-Host "Start writing local machine registry keys..." -ForegroundColor GREEN
131 | $MachineREG_ProU = "HKLM:\SOFTWARE\Liquidware Labs\ProfileUnity"
132 | if (!(Test-Path -Path $MachineREG_ProU )) {
133 | $Item = New-Item -Path $MachineREG_ProU -Force
134 | $Item.Handle.Close()
135 | }
136 | If ($AzureStorageCredentials) { New-ItemProperty -Path $MachineREG_ProU -Name AzureStorageCredentials -PropertyType String -Value $AzureStorageCredentials -Force | Out-Null }
137 | If ($SecondaryAzureStorageCredentials) { New-ItemProperty -Path $MachineREG_ProU -Name SecondaryAzureStorageCredentials -PropertyType String -Value $SecondaryAzureStorageCredentials -Force | Out-Null }
138 | If ($AmazonS3Credentials) { New-ItemProperty -Path $MachineREG_ProU -Name AmazonS3Credentials -PropertyType String -Value $AmazonS3Credentials -Force | Out-Null }
139 | If ($GoogleStorageCredentials) { New-ItemProperty -Path $MachineREG_ProU -Name GoogleStorageCredentials -PropertyType String -Value $GoogleStorageCredentials -Force | Out-Null }
140 | If ($SecondaryPaths) { New-ItemProperty -Path $MachineREG_ProU -Name SecondaryPaths -PropertyType String -Value $SecondaryPaths -Force | Out-Null }
141 | If ($ClientServiceExeCredsPath) { New-ItemProperty -Path $MachineREG_ProU -Name ClientServiceExeCredsPath -PropertyType String -Value $ClientServiceExeCredsPath -Force | Out-Null }
142 | If ($SystemINIPath) { New-ItemProperty -Path $MachineREG_ProU -Name INIPath -PropertyType String -Value $SystemINIPath -Force | Out-Null }
143 | If ($LicenseServerConnectionString) { New-ItemProperty -Path $MachineREG_ProU -Name LicenseServerConnectionString -PropertyType String -Value $LicenseServerConnectionString -Force | Out-Null }
144 | If ($ProfileDiskConfigNodesXmlPath) { New-ItemProperty -Path $MachineREG_ProU -Name ProfileDiskConfigNodesXmlPath -PropertyType String -Value $ProfileDiskConfigNodesXmlPath -Force | Out-Null }
145 | Write-Host "Finished writing local machine registry keys." -ForegroundColor GREEN
146 | Write-Host
147 |
148 | # Set HKCU reg values for Default user hive, current logged-on user and all other existing user profiles
149 | Write-Host "Start writing HKU registry keys..." -ForegroundColor GREEN
150 |
151 | #Load Default User registry hive
152 | reg load "HKLM\DefaultUser" "C:\Users\Default\NTUSER.DAT"
153 |
154 | #Add Liquidware settings to HKCU path of Default user AND all existing users on machine
155 | Add-AllUserRegSetting -RegPath "HKCU:\SOFTWARE\Liquidware Labs\ProfileUnity" -PropertyName "Enabled" -PropertyValue "1" -PropertyType "String" -DefaultUserMountPoint "HKLM:\DefaultUser"
156 | Add-AllUserRegSetting -RegPath "HKCU:\SOFTWARE\Liquidware Labs\ProfileUnity" -PropertyName "INIPath" -PropertyValue $UserINIPath -PropertyType "String" -DefaultUserMountPoint "HKLM:\DefaultUser"
157 |
158 | #Cleanup
159 | Set-Location c:\
160 | Start-Sleep -Milliseconds 500
161 | [gc]::collect()
162 | Start-Sleep -Seconds 1
163 |
164 | #Unload Default User registry hive
165 | reg unload hklm\DefaultUser
166 |
167 | #################################################################################################################################################
168 | # Fix Old Policy (legacy from previous installers)
169 |
170 | IF(test-path -path "C:\Windows\System32\GroupPolicy\Machine\*.pol"){
171 | Write-Host "Deleting old policy" -ForegroundColor Yellow
172 | Remove-Item -path "C:\Windows\System32\GroupPolicy\GPT.ini" -Force -ErrorAction SilentlyContinue
173 | Remove-Item -path "C:\Windows\System32\GroupPolicy\Machine\*.pol" -Force -ErrorAction SilentlyContinue
174 | Remove-Item -path "C:\Windows\System32\GroupPolicy\User\*.pol" -Force -ErrorAction SilentlyContinue
175 | Remove-Item -path "C:\Windows\System32\GroupPolicy\ADM\*.adm" -Force -ErrorAction SilentlyContinue
176 | }ELSE{
177 | Write-Host "No legacy Policy found" -ForegroundColor Yellow}
178 | Write-Host
179 | #################################################################################################################################################
180 |
181 | # Configure logoff script if SkipLogoffGPO is false
182 | If (!($SkipLogoffGPO)) {
183 | Write-Host "Start writing local logoff script GPO..." -ForegroundColor GREEN
184 | $ScriptsContent = @"
185 |
186 | [Logoff]
187 | 0CmdLine=C:\Program Files\ProfileUnity\Client.NET\LwL.ProfileUnity.Client.Logoff.exe
188 | 0Parameters=
189 | "@
190 |
191 | If (Test-Path "C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini") { Remove-Item -Path "C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini" -Force }
192 | If (!(Test-Path "C:\Windows\System32\GroupPolicy\User\Scripts")) { New-Item -Path "C:\Windows\System32\GroupPolicy\User\Scripts" -ItemType Directory -Force }
193 | $ScriptsContent | Out-File -FilePath "C:\Windows\System32\GroupPolicy\User\Scripts\scripts.ini" -Force
194 |
195 | $GptContent = @"
196 | [General]
197 | gPCUserExtensionNames=[{35378EAC-683F-11D2-A89A-00C04FBBCFA2}{D02B1F73-3407-48AE-BA88-E8213C6761F1}][{42B5FAAE-6536-11D2-AE5A-0000F87571E3}{40B66650-4972-11D1-A7CA-0000F87571E3}]
198 | Version=300000
199 | "@
200 |
201 | $GptContent | Out-File -FilePath "C:\Windows\System32\GroupPolicy\gpt.ini" -Force
202 |
203 | & "cmd.exe" "/c" "gpupdate.exe" "/force"
204 | } Else { Write-Host "SkipLogoffGPO is True! Skipping local logoff script GPO." -ForegroundColor GREEN
205 | Write-Host }
206 |
207 | # Last, reconfigure ProfileUnity Client Tools - if installed
208 | Write-Host "Attempting to reconfigure by running local Startup.Update.exe..." -ForegroundColor GREEN
209 | $StartupUpdate = "C:\Program Files\ProfileUnity\Client.NET\LwL.ProfileUnity.Client.Startup.Update.exe"
210 | If (Test-Path $StartupUpdate) {
211 | Write-Host "Reconfiguring ProfileUnity Client Tools..." -ForegroundColor GREEN
212 | Start-Process "$StartupUpdate" -Wait | Out-Null
213 | Write-Host "ProfileUnity Client Tools have been reconfigured. Done." -ForegroundColor GREEN
214 | } Else { Write-Host "No ProfileUnity Client Tools installation found!" -ForegroundColor RED
215 | }
216 | Write-Host
--------------------------------------------------------------------------------
/Scripts/ProfileUnityConsole_SilentInstall.ps1:
--------------------------------------------------------------------------------
1 | <#
2 |
3 | .SYNOPSIS
4 | Install ProfileUnity Console
5 |
6 | .DESCRIPTION
7 | This script ...
8 | makes use of powershell to silently install the ProfileUnity Console
9 | can be setup as a computer startup script for automated installs on boot
10 | will not run if any version of the ProfileUnity Console is already installed
11 | will not upgrade or downgrade an existing version
12 |
13 | #>
14 | # Installer EXE required
15 | $InstallerExe = "\\server\share\6.8.6 R1\ProfileUnity-Net.exe"
16 | # Optional post-install patches
17 | $Configfile = "\\server\share\6.8.6 R1\profileunity.host.exe.config"
18 | $ConsoleHotfix = "\\server\share\6.8.6 R1\ProfileUnityConsole-Hotfix.zip"
19 | $ClientToolsHotfix = "\\server\share\6.8.6 R1\client-tools.zip"
20 | $FpcInstallerUpdate = "\\server\share\6.8.6 R1\fpcsetup.exe"
21 |
22 | # Set the MongoDB prou_services account pw
23 | $Password = "ShouldChangeTh1s!"
24 | # Set the location where ProfileUnity will be installed so its skipped when already detected
25 | $PathToHostExe = "C:\Program Files (x86)\Liquidware Labs\ProfileUnity\ProfileUnity.Host.exe"
26 | $Logfile = "C:\Lab-Setup.log"
27 |
28 | $ErrorActionPreference = "continue"
29 |
30 | Function WaitForServices($SearchString, $Status) {
31 | # Get all services where name matches $SearchString and loop through each of them
32 | ForEach($Service In (Get-Service $SearchString)) {
33 | # Wait for the service to reach the $Status or a maximum of 5 minutes
34 | $Service.WaitForStatus($Status, "00:05:00")
35 | }
36 | }
37 |
38 | If (Test-Path $($InstallerExe) -PathType Leaf) {
39 | Try {
40 | # Log Output
41 | Start-Transcript -path $Logfile -append
42 |
43 | # Disable RDP Logins Until Configuration is Complete
44 | Write-Output "Disabling RDP Logins"
45 | & change logon /disable
46 |
47 | If (Test-Path $($PathToHostExe) -PathType Leaf) {
48 | Write-Output "ProfileUnity Console already installed."
49 | } Else {
50 | Write-Output "Installing ProfileUnity"
51 | & $InstallerExe /exenoui /qn USER=prou_services USER_PASSWORD="$Password" FLEXDISK_BROKER_MODE=0 MONGO_INSTALL_DIR="C:\Program Files\MongoDB" | Out-Null
52 | While ((Get-Service profileunity -ErrorAction SilentlyContinue) -eq $null) {
53 | Start-Sleep -Seconds 5
54 | }
55 | WaitForServices "profileunity" "Running"
56 | }
57 |
58 | # Check for and install hotfixes
59 | If ((Test-Path $($ConsoleHotfix),$($ClientToolsHotfix),$($FpcInstallerUpdate),$($Configfile) -PathType Leaf) -contains $true) {
60 | Stop-Service profileunity -Force -ErrorAction SilentlyContinue
61 | WaitForServices "profileunity" "Stopped"
62 |
63 | # Install Console Hotfix
64 | If (Test-Path $($ConsoleHotfix) -PathType Leaf) {
65 | Write-Output "Installing Console Hotfix $ConsoleHotfix"
66 | Expand-Archive -Path $($ConsoleHotfix) -DestinationPath "C:\Program Files (x86)\Liquidware Labs\ProfileUnity\" -Force
67 | }
68 |
69 | # Enable Metered Billing
70 | If (Test-Path $($Configfile) -PathType Leaf) {
71 | Write-Output "Installing profileunity.host.exe.config"
72 | Move-Item -Path $($Configfile) -Destination "C:\Program Files (x86)\Liquidware Labs\ProfileUnity\" -Force
73 | }
74 |
75 | Start-Service profileunity -ErrorAction SilentlyContinue
76 |
77 | # Install Client Tools Hotfix
78 | If (Test-Path $($ClientToolsHotfix) -PathType Leaf) {
79 | Write-Output "Installing Client Tools Hotfix $ClientToolsHotfix"
80 | Move-Item -Path $($ClientToolsHotfix) -Destination "C:\Program Files (x86)\Liquidware Labs\ProfileUnity\" -Force
81 | }
82 |
83 | # Install FPC Hotfix
84 | If (Test-Path $($FpcInstallerUpdate) -PathType Leaf) {
85 | Write-Output "Installing FPC Hotfix $FpcInstallerUpdate"
86 | Move-Item -Path $($FpcInstallerUpdate) -Destination "C:\Program Files (x86)\Liquidware Labs\ProfileUnity\" -Force
87 | }
88 | }
89 |
90 | # Enable RDP Login
91 | Write-Output "Enabling RDP Logins"
92 | & change logon /enable
93 |
94 | Write-Output "ProfileUnity Setup Finished"
95 | Exit $LastExitCode
96 | } Catch {
97 | $_
98 | Exit 0
99 | }
100 | }
--------------------------------------------------------------------------------
/Scripts/Share Creation/README.md:
--------------------------------------------------------------------------------
1 | # ProfileUnity-Share-Creation
2 |
3 | Description
4 |
5 | Bat Script to create fileshares and sets ACLS for profileUnity
6 |
7 |
8 | How to Use
9 | Run Script as admin
10 |
11 |
12 |
13 |
14 | Code
15 | ````
16 | mkdir c:\ProfileShare
17 | net share ProfileShare="C:\ProfileShare" /GRANT:"authenticated users",FULL /Grant:"Domain admins",Full /Grant:"authenticated users",Full
18 |
19 | Icacls c:\ProfileShare /inheritance:r /grant:r "Domain Users":(S,RD,AD) /grant:r "Domain Admins":(OI)(CI)(F) /grant:r "creator owner":(OI)(CI)(IO)(F) /grant:r "authenticated users":(S,RD,AD) /grant:r "system":(OI)(CI)(F) /grant:r "Domain Computers":(OI)(CI)(F)
20 |
21 | mkdir c:\ProfileUnity
22 | mkdir c:\ProfileUnity\ClientTools
23 | mkdir c:\ProfileUnity\User
24 | mkdir c:\ProfileUnity\Machine
25 | mkdir c:\ProfileUnity\FlexApps
26 | net share profileUnity="C:\ProfileUnity" /GRANT:"authenticated users",read /Grant:"Domain admins",Full /Grant:"Domain Users",read
27 |
28 | Icacls c:\ProfileUnity /inheritance:r /grant:r "Domain Users":(OI)(CI)(RX) /grant:r "Domain Admins":(OI)(CI)(F) /grant:r "authenticated users":(OI)(CI)(RX) /grant:r "system":(OI)(CI)(F) /grant:r "Domain Computers":(OI)(CI)(F)
29 |
30 | exit
31 |
32 |
33 | ````
34 |
35 |
36 |
37 | | OS Version | Verified |
38 | | ------------- | ------------- |
39 | |Windows 10 | YES |
40 | |Windows Server 2012 | YES |
41 | |Windows Server 2012 R2 | YES |
42 | |Windows Server 2008 R2 | YES |
43 | |Windows Server 2008 | YES |
44 | |Windows Server 2003 | YES |
45 | |Windows 8 | YES |
46 | |Windows 7 | YES |
47 | |Windows Vista | YES |
48 | |Windows XP | N0 |
49 | |Windows 2000 | No |
50 |
--------------------------------------------------------------------------------
/Scripts/Share Creation/ShareCreationScript.bat:
--------------------------------------------------------------------------------
1 | mkdir c:\ProfileShare
2 | net share ProfileShare="C:\ProfileShare" /GRANT:"authenticated users",FULL /Grant:"Domain admins",Full /Grant:"authenticated users",Full /Grant:"Domain Computers",Full
3 |
4 | Icacls c:\ProfileShare /inheritance:r /grant:r "Domain Users":(S,RD,AD) /grant:r "Domain Admins":(OI)(CI)(F) /grant:r "creator owner":(OI)(CI)(IO)(F) /grant:r "authenticated users":(S,RD,AD) /grant:r "system":(OI)(CI)(F) /grant:r "Domain Computers":(OI)(CI)(F)
5 |
6 | mkdir c:\ProfileUnity
7 | mkdir c:\ProfileUnity\ClientTools
8 | mkdir c:\ProfileUnity\User
9 | mkdir c:\ProfileUnity\Machine
10 | mkdir c:\ProfileUnity\FlexApps
11 | net share profileUnity="C:\ProfileUnity" /GRANT:"authenticated users",read /Grant:"Domain admins",Full /Grant:"Domain Users",read /Grant:"Domain Computers",Read
12 |
13 | Icacls c:\ProfileUnity /inheritance:r /grant:r "Domain Users":(OI)(CI)(RX) /grant:r "Domain Admins":(OI)(CI)(F) /grant:r "authenticated users":(OI)(CI)(RX) /grant:r "system":(OI)(CI)(F) /grant:r "Domain Computers":(OI)(CI)(F)
14 |
15 | exit
--------------------------------------------------------------------------------
/readme.md:
--------------------------------------------------------------------------------
1 | ![logo][] Liquidware Inc.
2 | ====================
3 |
4 | Welcome to the Liquidware GitHub Community!
5 |
6 | LiquidWare an industry leader and pioneer in desktop virtualization solutions for next-generation physical and virtual desktops, including VMware View®, Citrix® XenDesktop, Red Hat® and Microsoft® Windows®. The company's innovative and award-winning products include Stratusphere™ FIT and Stratusphere™ UX for desktop visibility; ProfileUnity™ with FlexApp™ and FlexDisk™ for desktop portability.
7 |
8 | New to ProfileUnity™?
9 | ------------------
10 |
11 | If you are new to ProfileUnity™ and would like to learn more, we recommend reviewing the [getting started][] documentation.
12 | There is also [Video Training] you can review as well.
13 |
14 | [getting started]: https://liquidwarelabs.zendesk.com/hc/en-us/articles/210641943-ProfileUnity-with-FlexApp-Documentation-
15 | [Video Training]: http://training.liquidware.com/products/profileunity
16 |
17 | Get ProfileUnity™
18 | --------------
19 |
20 | You can download and install a PowerShell package for any of the following platforms.
21 |
22 | | Downloads |
23 | | ---------------------- |
24 | | [Liquidware Downloads][Downloads] |
25 |
26 |
27 | [Downloads]: http://www.liquidware.com/download
28 | [logo]: https://avatars3.githubusercontent.com/u/24906944?v=3&s=200
--------------------------------------------------------------------------------