Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <#
- .NOTES
- ===========================================================================
- Created on: 1-3-2018
- Created by: Chris Twiest
- Organization: Workspace-Guru.com
- ===========================================================================
- .DESCRIPTION
- This script will create JSON files for LiquidWare ProfileUnity Filter Management.
- You fill in a base OU and the script will get all Child OU's in this OU.
- For each Child OU in the OU it will create a JSON file.
- This JSON file will contain the Condition OU User filter information based on the Child OU.
- You can then import the JSON files under Filter Management.
- #>
- $BaseOU = "OU=Groups,dc=Domain,dc=com"
- $WorkingDirectory = "C:\Temp"
- import-module ActiveDirectory
- $ChildOUS = Get-ADOrganizationalUnit -Filter * -SearchBase $baseOU | Sort {-join ($_.distinguishedname[($_.distinguishedname.length-1)..0])}
- $TestWorkingDirectory = $WorkingDirectory | Test-Path
- if ($TestWorkingDirectory -eq $False)
- {
- New-Item -ItemType Directory -Path $WorkingDirectory
- }
- New-Item -ItemType Directory -Path "$WorkingDirectory\Filters"
- foreach ($ChildOU in $ChildOUS) {
- $ChildOUName = $ChildOU.Name
- $filename = "OU="+"$ChildOUName"
- $ChildOUDis = $ChildOU.DistinguishedName
- New-Item -ItemType file -Path "$WorkingDirectory\Filters\$Filename.json"
- $file = "$WorkingDirectory\Filters\$Filename.json"
- $contentfile = '{
- "DateExported": "2018-03-01T12:34:30.9207481Z",
- "ProuVersion": "6.7.0.6422",
- "Configurations": [],
- "Filters": [
- {
- "Comments": "",
- "Connections": 60,
- "FilterRules": [
- {
- "ConditionType": 14,
- "MatchType": 0,
- "Value": "'
- $contentfile2 = $ChildOUDis
- $contentfile3 = '" }
- ],
- "MachineClasses": 62,
- "Name": "'
- $contentfile4 = $Filename
- $Contentfile5 = '",
- "OperatingSystems": 4094,
- "RuleAggregate": 0,
- "SystemEvents": 3,
- "CreatedBy": "admin",
- "DateCreated": "2018-03-01T12:32:14Z",
- "DateLastModified": "2018-03-01T12:34:25.535Z",
- "Disabled": false,
- "LastModifiedBy": "admin",
- "Id": "5a97f2ce6db5560804ba9b2f"
- }
- ],
- "PortabilityRulesets": [],
- "Templates": []
- }'
- $content = $contentfile + $contentfile2 + $contentfile3 + $contentfile4 + $Contentfile5
- Add-Content $file $content
- }
Advertisement
Add Comment
Please, Sign In to add comment