Skip to content

Get NPSession

Marc Collins edited this page Dec 4, 2018 · 1 revision

Get-NPSession

SYNOPSIS

Used to establish a Authenticated Session with the NPrinting API's

SYNTAX

Default (Default)

Get-NPSession [[-Computer] <String>] [[-Port] <String>] [-Prefix <String>] [-Return] [-Credentials <PSCredential>] [-TrustAllCerts] [<CommonParameters>]

Creds

Get-NPSession [-Return] [-Credentials <PSCredential>] [<CommonParameters>]

DESCRIPTION

Simply using 'Get-NPSession' 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.

EXAMPLES

EXAMPLE 1

Default Values

C:\PS> Get-NPSession

User will use default credentials to connect to NPrinting on the local machine, using default values for prefix and port

EXAMPLE 2

Alternative Credentials

C:\PS> $Creds = Get-Credential
Get-NPSession -Credentials $Creds -TrustAllCerts

User will be prompted for Credentials, once entered these credentials will be used to connect to NPrinting on the local machine, using default values for prefix and port.

EXAMPLE 3

Non-defaults

C:\PS> $Creds = Get-Credentials
Get-NPSession -Credentials $Creds -TrustAllCerts -Computer http://NPr1nt01:9999

User will be prompted for Credentials, once entered these credentials will be used to connect to NPrinting running on a system called NPr1nt01 using http on port 9999 NB: why you would do that is anyone's guess... maybe you just like making life difficult for yourself?

PARAMETERS

Prefix

used to specify if HTTP or HTTPS is to be used to establish the connection

Type: String
Parameter Sets: Default
Aliases: 

Required: false
Position: named
Default Value: https
Accepted Values: http
                 https
Pipeline Input: False

Computer

Used to specify the NPrinting Server to connect to. can be used to specify Prefix and Port values as well. e.g. computername https://computername:port

Type: String
Parameter Sets: Default
Aliases: 

Required: false
Position: 0
Default Value: $ENV:ComputerName
Pipeline Input: False

Port

Port that NPrinting is running on

Type: String
Parameter Sets: Default
Aliases: 

Required: false
Position: 1
Default Value: 4993
Pipeline Input: False

Return

Returns the Authentication token to the Script. This can then be used for customized API calls not using the module

Type: SwitchParameter
Parameter Sets: (All)
Aliases: 

Required: false
Position: named
Default Value: 
Pipeline Input: False

Credentials

Used to specify specific user credentials to connect to the API with. If omitted session will be established with current logged on users credentials

Type: PSCredential
Parameter Sets: (All)
Aliases: 

Required: false
Position: named
Default Value: 
Pipeline Input: False

TrustAllCerts

Switch parameter used to ignore Certificate Issuer Trust.

Type: SwitchParameter
Parameter Sets: Default
Aliases: 

Required: false
Position: named
Default Value: 
Pipeline Input: False

<CommonParameters>

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

OUTPUTS

System.Object

NOTES

Surprise

No one reads this far down the help! You must have skimmed... anyway you win a cookie!!! Congratulations. Cookies can be collected from the cookie collection booth on the Fifth Sunday in February on any given Leap Year, next scheduled collection time: 2032-02-29 from 9:25am-9:28am

RELATED LINKS

Authentication - Login

Generated by: PowerShell HelpWriter 2019 v2.3.42