Bug Fix: Added missing parameter
Bug Fix: Json Depth defaults to 5
Minor improvements
Updated and aligned with PowerShell Gallery
Function:
- Invoke-NPRequest:
- Added parameters with default values for required -NPE query path parameters
Get-PackageProvider -Name NuGet -ForceBootstrap
# Install for all users, requires admin rights
Install-Module QlikNPrinting-CLI
# Install for current user
Install-Module QlikNPrinting-CLI -Scope CurrentUser
# Once Installed you can import the Module
Import-Module QlikNPrinting-CLI
To manually install the module, download the latest release from Release
Extract the Downloaded file into the appropriate module directory,
You can check the configured paths by checking the output of the command $env:PSModulePath
Default locations are
- System Module
C:\Program Files\WindowsPowerShell\Modules
- User Module
C:\users\<username>\Documents\WindowsPowerShell\Modules
Simply using 'Connect-NPrinting' will assume that NPrinting is running on the current machine (where you are running the Script from) It will attempt to connect to NPrinting with the Current Logged on users credentials. It will use the Default Port and HTTPS for the connection.
Connect-NPrinting
Connect-NPrinting -Computer https://Server:9999
Connect-NPrinting -Prefix https -Computer Server -Port 9999
Connect-NPrinting -Computer https://Server -Port 9999
If the Server is using a Default Cert, Powershell May not trust it, if that is the case add -TrustAllCerts
Connect-NPrinting -TrustAllCerts
NTLM Authentication used by default or NPrinting ([email protected]) can be selected
$Creds = Get-Credential
Connect-NPrinting -Credentials $Creds
Connect-NPrinting -TrustAllCerts -Credentials $Creds -AuthScheme NPrinting
Connect-NPrinting -Credentials $Creds -TrustAllCerts -Computer https://server:9999
Once you have successfully established a authenticated NPSession. You can use any of the following module commands:
Get-NPUsers
Get-NPTasks
Get-NPRoles
Get-NPReports
Get-NPGroups
Get-NPApps
Get-NPFilters
If you need the ability to do more you can use Invoke-NPRequest
The NPrinting API lists the available APIs.
e.g
Get /apps/{id}
Which can then be used in the following ways
Invoke-NPRequest -method Get -Path 'apps'
$IDApp = "70d20d7e-d013-4bc0-8398-6f890041f89b"
Invoke-NPRequest -method Get -Path 'apps/$IDApp'
Invoke-NPRequest -method Get -Path 'users'
$IDUser = "033eeaf0-956e-41fa-83be-f7876479844a"
Invoke-NPRequest -method Get -Path 'users/$IDUser'
Invoke-NPRequest -method Delete -Path 'users/$IDUser'
$Data = @(
UserName = "ChangeName"
)
$DataJSON = $Data|ConvertTo-Json
Invoke-NPRequest -method Put 'users/$IDUser' -Data $DataJSON
$Data = @(
password = "changeme"
email = "[email protected]"
enabled = $true
UserName = "ChangeName"
timezone = "Australia/Melbourne"
Locale = "en"
)
$DataJSON = $Data|ConvertTo-Json
Invoke-NPRequest -method Post -Path "users" -Data $DataJSON