Skip to content

Set-ConfluenceInfo does not persist when called in a functionΒ #199

@mcx808

Description

@mcx808

I created a draft powershell script that called the following in the begin{} block:
Set-ConfluenceInfo -BaseURi "$baseUri" -Credential $ConfluenceCredential
Then in the process{} block I would use Get-ConfluencePage and Set-ConfluencePage with the following parameters:
Get-ConfluencePage -SpaceKey $SpaceKey | Where-Object {$_.Title -eq $PageTitle}

Once I was happy with the script I created a function around it and added to a module but it would always ask me for the ApiUrl when Get-ConfluencePage was called.

I temporary workaround was to add the following when wrapping as a function

$PSDefaultParameterValues['Disabled'] = $true
$apiUri = $baseUri + '/rest/api'
Get-ConfluencePage -SpaceKey $SpaceKey -ApiUri $apiUri -Credential $ConfluenceCredential| Where-Object {$_.Title -eq $PageTitle}

Is there a known issue for why the behaviour is different and incompatible when called as a function instead of script?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions