Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Account Onboard Utility/Accounts_Onboard_Utility.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -698,11 +698,11 @@ The Header as Dictionary object
$restResponse = ''
try {
if ([string]::IsNullOrEmpty($Body)) {
Write-LogMessage -type Verbose -MSG "Invoke-Rest:`tInvoke-RestMethod -Uri $URI -Method $Command -Header $($Header|ConvertTo-Json -Compress) -ContentType $ContentType -TimeoutSec $TimeoutSec"
Write-LogMessage -type Verbose -MSG "Invoke-Rest:`tInvoke-RestMethod -Uri $URI -Method $Command -Header $($Header|ConvertTo-Json -Depth 99 -Compress ) -ContentType $ContentType -TimeoutSec $TimeoutSec"
$restResponse = Invoke-RestMethod -Uri $URI -Method $Command -Header $Header -ContentType $ContentType -TimeoutSec $TimeoutSec -ErrorAction $ErrAction -Verbose:$false -Debug:$false
}
else {
Write-LogMessage -type Verbose -MSG "Invoke-Rest:`tInvoke-RestMethod -Uri $URI -Method $Command -Header $($Header|ConvertTo-Json -Compress) -ContentType $ContentType -Body $($Body|ConvertTo-Json -Compress) -TimeoutSec $TimeoutSec"
Write-LogMessage -type Verbose -MSG "Invoke-Rest:`tInvoke-RestMethod -Uri $URI -Method $Command -Header $($Header|ConvertTo-Json -Depth 99 -Compress) -ContentType $ContentType -Body $($Body|ConvertTo-Json -Compress) -TimeoutSec $TimeoutSec"
$restResponse = Invoke-RestMethod -Uri $URI -Method $Command -Header $Header -ContentType $ContentType -Body $Body -TimeoutSec $TimeoutSec -ErrorAction $ErrAction -Verbose:$false -Debug:$false
}
Write-LogMessage -type Verbose -MSG "Invoke-Rest:`tInvoke-RestMethod completed without error"
Expand Down Expand Up @@ -1777,14 +1777,14 @@ ForEach ($account in $accountsCSV) {
Write-LogMessage -type Verbose -MSG "Base:`tAccount '$g_LogAccountName' exists"
# Get Existing Account Details
Write-LogMessage -type Verbose -MSG "Base:`tRetrived $($objAccount.userName) from the CSV"
Write-LogMessage -type Verbose -MSG "Base:`tOutput of $($objAccount.userName) from the CSV in JSON: $($objAccount|ConvertTo-Json -Depth 5)"
Write-LogMessage -type Verbose -MSG "Base:`tOutput of $($objAccount.userName) from the CSV in JSON: $($objAccount|ConvertTo-Json -Depth 5 -Compress)"
$s_Account = $(Get-Account -safeName $objAccount.safeName -accountName $objAccount.userName -accountAddress $objAccount.Address -accountObjectName $objAccount.name)
If ($s_Account.Count -gt 1) {
Throw "Too many accounts for '$g_LogAccountName' in safe $($objAccount.safeName)"
}
Write-LogMessage -type Verbose -MSG "Base:`tRetrived $($objAccount.userName) from Safe $($objAccount.safeName)"
Write-LogMessage -type Verbose -MSG "Base:`tRAW format: $s_Account"
Write-LogMessage -type Verbose -MSG "Base:`tConverted to JSON: $($s_Account|ConvertTo-Json -Depth 5)"
Write-LogMessage -type Verbose -MSG "Base:`tConverted to JSON: $($s_Account|ConvertTo-Json -Depth 5 -Compress)"
If ($Update) {
$updateChange = $false
$s_AccountBody = @()
Expand Down
4 changes: 2 additions & 2 deletions Connection Component/Import-ConnectionComponents.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -350,11 +350,11 @@ The Header as Dictionary object
$restResponse = ''
try {
if ([string]::IsNullOrEmpty($Body)) {
Write-LogMessage -type Verbose -MSG "Invoke-Rest:`tInvoke-RestMethod -Uri $URI -Method $Command -Header $($Header|ConvertTo-Json -Compress) -ContentType $ContentType -TimeoutSec $TimeoutSec"
Write-LogMessage -type Verbose -MSG "Invoke-Rest:`tInvoke-RestMethod -Uri $URI -Method $Command -Header $($Header|ConvertTo-Json -Depth 99 -Compress) -ContentType $ContentType -TimeoutSec $TimeoutSec"
$restResponse = Invoke-RestMethod -Uri $URI -Method $Command -Header $Header -ContentType $ContentType -TimeoutSec $TimeoutSec -ErrorAction $ErrAction -Verbose:$false -Debug:$false
}
else {
Write-LogMessage -type Verbose -MSG "Invoke-Rest:`tInvoke-RestMethod -Uri $URI -Method $Command -Header $($Header|ConvertTo-Json -Compress) -ContentType $ContentType -Body $($Body|ConvertTo-Json -Compress) -TimeoutSec $TimeoutSec"
Write-LogMessage -type Verbose -MSG "Invoke-Rest:`tInvoke-RestMethod -Uri $URI -Method $Command -Header $($Header|ConvertTo-Json -Depth 99 -Compress) -ContentType $ContentType -Body $($Body|ConvertTo-Json -Depth 99 -Compress) -TimeoutSec $TimeoutSec"
$restResponse = Invoke-RestMethod -Uri $URI -Method $Command -Header $Header -ContentType $ContentType -Body $Body -TimeoutSec $TimeoutSec -ErrorAction $ErrAction -Verbose:$false -Debug:$false
}
Write-LogMessage -type Verbose -MSG "Invoke-Rest:`tInvoke-RestMethod completed without error"
Expand Down
2 changes: 1 addition & 1 deletion Identity Authentication/IdentityAuth.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ function Get-OAuthCreds {
"grant_type" = "client_credentials"
"client_id" = $($OAuthCreds.GetNetworkCredential().UserName)
"client_secret" = $($OAuthCreds.GetNetworkCredential().Password)
}
}
Return $($(Invoke-RestMethod "$IdaptiveBasePlatformURL/oauth2/platformtoken/" -Method 'POST' -Body $body).access_token)
}

Expand Down
2 changes: 1 addition & 1 deletion Migration/Migration via REST/CyberArk-Migration.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1208,7 +1208,7 @@ Function New-Account {
)
$URL_NewAccount = "$url/api/Accounts/"
Write-LogMessage -Type Debug -MSG "Entering New-Account"
Write-LogMessage -Type Verbose -MSG "Recieved the following for new account: `n$($account | ConvertTo-Json)"
Write-LogMessage -Type Verbose -MSG "Recieved the following for new account: `n$($account | ConvertTo-Json -Depth 9 -Compress)"
Try {
If ($allowEmpty) {
$result = Invoke-Rest -Command Post -Uri $URL_NewAccount -header $logonHeader -Body $($account | ConvertTo-Json -Compress)
Expand Down
10 changes: 5 additions & 5 deletions Migration/Migration via REST/Invoke-Process.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Function Invoke-ProcessSafe {
Log = @()
Error = @()
}

Function Write-LogMessage {
param(
[String]$MSG,
Expand All @@ -39,7 +39,7 @@ Function Invoke-ProcessSafe {
If ($safename -in $objectSafesToRemove) {
Write-LogMessage -Type Info -Msg "Safe `"$($safename)`" is in the excluded safes list and will be skipped"
$SafeStatus.success = $true
write-LogMessage -Type Verbose -Msg "Final `$SafeStatus $($SafeStatus | ConvertTo-Json -Compress)"
write-LogMessage -Type Verbose -Msg "Final `$SafeStatus $($SafeStatus | ConvertTo-Json -Compress -Depth 9)"
continue
}
Write-LogMessage -Type Debug -Msg "Getting source safe `"$safename`""
Expand Down Expand Up @@ -145,7 +145,7 @@ Function Invoke-ProcessSafe {
$srcMember.membername = $($($srcMember.membername).Split("@"))[0]
$srcMember.memberType = "Role"
$null = New-SafeMember -url $dstPVWAURL -logonHeader $dstToken -safe $safename -safemember $srcMember

Write-LogMessage -Type Info -Msg "[$($safememberCount)] Safe Member $($srcMember.MemberType) `"$($srcMember.membername)`" added to safe `"$($dstsafe.safename)`" succesfully"
}
} elseif ($srcMember.memberType -eq "User") {
Expand All @@ -164,7 +164,7 @@ Function Invoke-ProcessSafe {
}
Write-LogMessage -Type Info -Msg "[$($safememberCount)] Attempting to add user `"$($srcMember.membername)`" to safe `"$($dstsafe.safename)`""
$null = New-SafeMember -url $dstPVWAURL -logonHeader $dstToken -safe $safename -safemember $srcMember

Write-LogMessage -Type Debug -Msg "[$($safememberCount)] Safe Member User`"$($srcMember.membername)`" added to safe `"$($dstsafe.safename)`""
} elseif ($srcMember.memberType -eq "Group") {
Write-LogMessage -Type Debug -Msg "[$($safememberCount)] Safe Member `"$($srcMember.membername)`" is a group, attempting to find source"
Expand Down Expand Up @@ -220,4 +220,4 @@ Function Invoke-ProcessSafe {
$SafeStatus.success = $false
}
}
}
}
30 changes: 15 additions & 15 deletions Migration/Migration via REST/Migrate.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Function Get-CPMUsers {
[OutputType([System.Boolean])]
[CmdletBinding()]
[OutputType([String[]])]
param([switch]$SuppressCPMWarning)
param([switch]$SuppressCPMWarning)
$URL_GetCPMList = "$script:srcPVWAURL/API/ComponentsMonitoringDetails/CPM/"
Try {
$CPMList = Invoke-RestMethod -Method Get -Uri $URL_GetCPMList -Headers $Script:srcToken -ErrorVariable ErrorCPMList
Expand Down Expand Up @@ -567,7 +567,7 @@ Switch to prevent running in powershell job
Initialize-Function
Test-SessionsValid
Test-AccountList
$global:DomainList = $script:DomainList
$global:DomainList = $script:DomainList
#region Safe Work

$cpmUsers = Get-CPMUsers -SuppressCPMWarning:$SuppressCPMWarning
Expand Down Expand Up @@ -708,7 +708,7 @@ Switch to prevent running in powershell job
}
else {
Write-LogMessage -type Verbose -MSG "Final `$SafeStatus $($SafeStatus |Select-Object -Property Id,SafeName,createSkip,Success,UpdateMembersFail | ConvertTo-Json -Depth 1 -Compress)"
}
}
$SafeStatus
$process.Completed = $true
}
Expand Down Expand Up @@ -759,7 +759,7 @@ Switch to prevent running in powershell job
$i++
}
}

$SafeFailed.SafeData | Export-Csv .\FailedSafes.csv
}
Write-LogMessage -type Info "Safes succesfully processed: $($SafeSuccess.success.count)"
Expand Down Expand Up @@ -1180,7 +1180,7 @@ To get further information about the paramaters use "Get-Help Sync-Accounts -ful
[array]$AccountFailed.accountData | Add-Member -MemberType NoteProperty -Name FailReason -Value $null -Force
$i = 0
foreach ($id in $AccountFailed) {
$AccountFailed[$i].accountData.FailReason = $AccountFailed[$i].Error
$AccountFailed[$i].accountData.FailReason = $AccountFailed[$i].Error
$i++
}
$AccountFailed.accountData | Export-Csv -Force .\FailedAccounts.csv
Expand All @@ -1192,28 +1192,28 @@ To get further information about the paramaters use "Get-Help Sync-Accounts -ful

Function Set-DomainList {
(
[Parameter(Mandatory)]

$domainJSon
)
$script:DomainList = $domainJSon
}


Function New-DomainList
Function New-DomainList
(
[Parameter(Mandatory)]

$DomainName,
[Parameter(Mandatory)]

$DomainBaseContext
) {
[hashtable]$script:DomainList = @{}
$script:DomainList.add($DomainBaseContext, $DomainName)
}
Function New-DomainEntry
Function New-DomainEntry
(
[Parameter(Mandatory)]

$DomainName,
[Parameter(Mandatory)]

$DomainBaseContext
) {
IF ([string]::IsNullOrEmpty($script:domainlist)) {
Expand All @@ -1230,11 +1230,11 @@ Function New-DomainEntry
}
}

Function Remove-DomainEntry
Function Remove-DomainEntry
(
[Parameter(Mandatory)]

$DomainName,
[Parameter(Mandatory)]

$DomainBaseContext
) {
IF ([string]::IsNullOrEmpty($script:domainlist[$DomainBaseContext])) {
Expand Down
Loading