GPPower Shell
GPPower Shell
Limitation of liability This document is provided “as-is”. Information and views expressed in this document, including
URL and other Internet Web site references, may change without notice. You bear the risk of using
it.
Some examples depicted herein are provided for illustration only and are fictitious. No real
association or connection is intended or should be inferred.
Intellectual property This document does not provide you with any legal rights to any intellectual property in any
Microsoft product.
You may copy and use this document for your internal, reference purposes.
Trademarks Microsoft, Microsoft Dynamics, Windows, and Windows Server are trademarks of the Microsoft
group of companies. FairCom and c-tree Plus are trademarks of FairCom Corporation and are
registered in the United States and other countries.
Warranty disclaimer Microsoft Corporation disclaims any warranty regarding the sample code contained in this
documentation, including the warranties of merchantability and fitness for a particular purpose.
License agreement Use of this product is covered by a license agreement provided with the software product. If you
have any questions, please call the Microsoft Dynamics GP Customer Assistance Department at
800-456-0025 (in the U.S. or Canada) or +1-701-281-6500.
Index ................................................................................................................................................................... 27
P O W E R S H E L L U S E R S G U I D E i
ii P O W E R S H E L L U S E R S G U I D E
Introduction
The Microsoft Dynamics GP 2013 PowerShell module provides PowerShell cmdlets
to perform various configuration tasks for a Microsoft Dynamics GP installation.
Product support
Technical support for the Microsoft Dynamics GP PowerShell module can be
accessed by the following methods:
Symbol Description
The light bulb symbol indicates helpful tips, shortcuts
and suggestions.
Margin notes summarize Margin notes call attention to critical information, and
important information. direct you to other areas of the documentation where a
topic is explained.
Convention Description
Chapter 1, “Installation” Quotation marks indicate a chapter name.
Setting window fields Italicized type indicates a section name.
set 'l_Item' to 1. This font is used for code examples.
RUNTIME.EXE Words in uppercase indicate a file name.
P O W E R S H E L L U S E R S G U I D E 1
2 P O W E R S H E L L U S E R S G U I D E
Chapter 1: Installation
This portion of the documentation explains how to install the Microsoft Dynamics
GP PowerShell module. The following topics are discussed:
• Prerequisites
• Installing Microsoft Dynamics GP PowerShell
Prerequisites
To use the Microsoft Dynamics GP PowerShell module, you must have PowerShell
3.0 installed. This version of PowerShell is included with Windows Server 2012. If
you are using an earlier release of Windows, you will need to install this version of
PowerShell.
http://www.microsoft.com/download
P O W E R S H E L L U S E R S G U I D E 3
C H A P T E R 1 I N S T AL LA T IO N
\AdProd\GPPowerShell\
4 P O W E R S H E L L U S E R S G U I D E
Chapter 2: Using PowerShell
This portion of the documentation discusses how to use the Microsoft Dynamics GP
2013 PowerShell module. The following topics are discussed:
• Starting PowerShell
• Getting a list of commands
• What to do next
Starting PowerShell
To start the command prompt for the Microsoft Dynamics GP 2013 PowerShell
module, do one of the following:
• Choose Start >> All Programs >> Microsoft Dynamics >> GP PowerShell >>
Microsoft Dynamics GP 2013 PowerShell
Get-Help Set-GPSessionCentralAddress
To display all of the help information for a cmdlet, include the -full parameter:
P O W E R S H E L L U S E R S G U I D E 5
C H A P T E R 2 U S I N G P O W E R S H EL L
What to do next
It’s up to you to decide which tasks you want to perform with the PowerShell
cmdlets. For example, the “scale groups” functionality for the multitenant Microsoft
Dynamics GP web client is configured using PowerShell cmdlets. Refer to the
Chapter 3, “Microsoft Dynamics GP Cmdlets,” for information about the cmdlets
that are available in the PowerShell module.
6 P O W E R S H E L L U S E R S G U I D E
Chapter 3: Microsoft Dynamics GP Cmdlets
The following cmdlets are available for Microsoft Dynamics GP:
• Add-GPScaleGroupTenant
• Get-GPScaleGroup
• Get-GPScaleGroupTenant
• Get-GPSessionCentralAddress
• Get-GPSessionHost
• Get-GPSessionHostTenant
• Get-GPSessions
• Get-GPWebClientVersion
• New-GPScaleGroup
• Remove-GPScaleGroup
• Remove-GPScaleGroupTenant
• Remove-GPSessionHost
• Set-GPSessionCentralAddress
• Update-GPScaleGroup
• Update-GPScaleGroupTenant
• Update-GPSessionHost
• Update-GPSessionHostTenant
P O W E R S H E L L U S E R S G U I D E 7
A D D - G P S C A L E G R O U P T E N A N T
Add-GPScaleGroupTenant
Description Adds a tenant to a scale group. The cmdlet accepts the name of the tenant as well as
either the scale group Id or the scale group name for which to assign the tenant.
• -ScaleGroupId <Int32>
The Id of the scale group to which the tenant will be added.
• -ScaleGroupName <String>
The name of the scale group to whichthe tenant will be added.
• <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
8 P O W E R S H E L L U S E R S G U I D E
G E T - G P S C A L E G R O U P
Get-GPScaleGroup
Description Retrieves a single scale group or a list of scale groups.
• -ScaleGroupName <String>
The name of the scale group to retrieve.
• <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
Comments The Get-GPScaleGroup cmdlet returns the properties for a single scale group if the
Id or name parameters are provided. If parameters are not provided, a list of all
scale groups and their properties is returned.
Examples Example 1 returns the properties for the default scale group.
Get-GPScaleGroup
P O W E R S H E L L U S E R S G U I D E 9
G E T - G P S C A L E G R O U P T E N A N T
Get-GPScaleGroupTenant
Description Retrieves the list of tenants that are assigned to a scale group.
• -ScaleGroupId <Int32>
The Id of the scale group for which to return assignments.
• -ScaleGroupName <String>
The name of the scale group for which to return assignments.
• <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
Comments If the tenant name is provided, then a single assignment will be returned, provided
that the tenant has been assigned to a scale group. If the scale group name or Id is
provided, the Get-GPScaleGroupTenant cmdlet returns the list of tenants that are
assigned to that single scale group. If no parameter is supplied, a list of all scale
group assignments for all tenants will be returned.
Examples Example 1 returns the list of tenant assignments for the default scale group.
Example 2 returns a list of all scale group assignments for all tenants.
Get-GPScaleGroupTenant
10 P O W E R S H E L L U S E R S G U I D E
G E T - G P S E S S I O N C E N T R A L A D D R E S S
Get-GPSessionCentralAddress
Description Retrieves the address (URL) for the Session Central Service that is being accessed by
the PowerShell cmdlets. This value was set by the Set-GPSessionCentralAddress
cmdlet.
Parameters • <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
Examples The following example retrieves the address that had been specified as the Session
Central Service to access.
Get-GPSessionCentralAddress
P O W E R S H E L L U S E R S G U I D E 11
G E T - G P S E S S I O N H O S T
Get-GPSessionHost
Description Retrieves information about a session host or a list of session hosts.
• -OnlyActive [<SwitchParameter>]
If present, returns only active session hosts.
• -OnlyInactive [<SwitchParameter>]
If present, returns only inactive or suspended session hosts.
• -ScaleGroupId <Int32>
The Id of the scale group on which to filter the returned session hosts.
• -ScaleGroupName <String>
The name of the scale group on which to filter the return session hosts.
• <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
Comments The Get-GPSessionHost cmdlet returns the session hosts for the specified session
host or scale group if either are provided. Otherwise, it returns all session hosts.
Examples Example 1 returns the properties for the session host with Id SessionHost1.
Get-GPSessionHost
Example 3 returns the properties for all session hosts that are assigned to the default
scale group.
Get-GPSessionHost -OnlyInactive
12 P O W E R S H E L L U S E R S G U I D E
G E T - G P S E S S I O N H O S T T E N A N T
Get-GPSessionHostTenant
Description Retrieves the tenant assignment and status of a session host.
• -TenantName <String>
The tenant name on which to filter assignments.
• <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
Examples Example 1 returns a list of tenant assignments for the session host with Id
SessionHost1.
P O W E R S H E L L U S E R S G U I D E 13
G E T - G P S E S S I O N S
Get-GPSessions
Description Retrieves the current sessions on one or more session hosts.
• -OnlyActive [<SwitchParameter>]
If present, returns only active sessions.
• -OnlyInactive [<SwitchParameter>]
If present, returns only inactive sessions.
• -ScaleGroupId <Int32>
The Id of the scale group for which to get sessions.
• -ScaleGroupName <String>
The name of the scale group for which to get sessions.
• <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
Comments The Get-GPSessions cmdlet returns all sessions found on the specified session host
or scale group if either are provided. Otherwise, it returns all sessions. Providing
the -OnlyActive or -OnlyInactive switch parameters filters sessions based on their
status.
Examples Example 1 returns both active and inactive sessions on the session host with Id
SessionHost1.
Example 2 returns both active and inactive sessions on all of the session hosts in the
default scale group.
Get-GPSessions -OnlyInactive
Example 4 returns inactive sessions on all session hosts in the default scale group.
14 P O W E R S H E L L U S E R S G U I D E
G E T -G PW E B C L I E N T V E R S I O N
Get-GPWebClientVersion
Description Retrieves the version information for the Microsoft Dynamics GP Web Client that is
installed.
Parameters • <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
Examples The following example retrieves the version information for the Microsoft
Dynamics GP Web Client that is installed.
Get-GPWebClientVersion
P O W E R S H E L L U S E R S G U I D E 15
N E W -G PS C A L E G R O U P
New-GPScaleGroup
Description Creates a new scale group.
• -Description <String>
The description of the scale group to create.
• -SetInactive [<SwitchParameter>]
Indication to set the status of the scale group to inactive.
• <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
Comments The New-GPScaleGroup cmdlet accepts the name and description for a scale group
to create. The created scale group is active by default. To set the status to inactive,
provide the -SetInactive switch parameter.
Examples Example 1 creates a scale group with the provided name and description. The status
of the scale group is set to active by default.
Example 2 creates a scale group with the provided name and description. The status
of the scale group is set to inactive.
16 P O W E R S H E L L U S E R S G U I D E
R E M O V E - G P S C A L E G R O U P
Remove-GPScaleGroup
Description Deletes one or more scale groups.
• -Force [<SwitchParameter>]
Executes the command without prompting for confirmation.
• -WhatIf [<SwitchParameter>]
Displays a message that describes the effect of the command, instead of executing
the command.
• -Confirm [<SwitchParameter>]
Prompts for confirmation before executing the command.
• -ScaleGroupName <String>
The name of the scale group to delete.
• -ScaleGroups <ScaleGroup[]>
A list of scale groups to delete. See example 3 for usage.
• <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
Comments The Remove-GPScaleGroup cmdlet deletes the specified scale group or groups.
There must not be any session hosts assigned to the specified scale groups.
Examples Example 1 removes the scale group with the name ScaleGroup1.
Remove-GPScaleGroup -ScaleGroupId 5
Get-GPScaleGroup | Remove-GPScaleGroup
P O W E R S H E L L U S E R S G U I D E 17
R E M O V E -G PS C A L E G R O U P T E N A N T
Remove-GPScaleGroupTenant
Description Removes a tenant from a scale group.
• -Force [<SwitchParameter>]
Executes the command without prompting for confirmation.
• -WhatIf [<SwitchParameter>]
Displays a message that describes the effect of the command instead of executing
the command.
• -Confirm [<SwitchParameter>]
Prompts for confirmation before executing the command.
• -Assignments <ScaleGroupTenantAssignment[]>
A list of tenant to scale group assignments to delete. See example 2 for usage.
• <CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutBuffer and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216).
Comments The Remove-GPScaleGroupTenant cmdlet deletes the scale group assignment for
the specified tenant. When no scale group assignment exists for a tenant, Session
Central will use the default scale group for the tenant.
Examples Example 1 removes the scale group assignment for Tenant1. After the command has
finished, Tenant1 is assumed to be part of the default scale group.
Example 2 removes all scale group assignments for all tenants that are assigned to
the scale group with the Id 1.
18 P O W E R S H E L L U S E R S G U I D E
R E M O V E - G P S E S S I O N H O S T
Remove-GPSessionHost
Description Deletes the specified session host so that the Session Central Service will no longer
be able to use it. The session host must not have any active sessions.
• -Force [<SwitchParameter>]
Executes the command with prompting for confirmation.
• -WhatIf [<SwitchParameter>]
Displays a message that describes the effect of the command instead of executing
the command.
• -Confirm [<SwitchParameter>]
Prompts you for confirmation before executing the command.
• -SessionHosts <SessionHost[]>
A list of session hosts to delete. See example 2 for usage.
• <CommonParameter>
This cmdlet supports the common parameters: Verbos, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutButter and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216)
Example 2 removes all of the session hosts that are assigned to the default scale
group.
P O W E R S H E L L U S E R S G U I D E 19
S E T - G P S E S S I O N C E N T R A L A D D R E S S
Set-GPSessionCentralAddress
Description Specifies the Session Central Service that will be accessed by the PowerShell
cmdlets.
• <CommonParameter>
This cmdlet supports the common parameters: Verbos, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutButter and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216)
Comments You must have proper permission to run cmdlets that access the Session Central
Service. Typically, the account that was specified to run the Session Central Service
at the time the Microsoft Dynamics GP Web Client web site was installed will have
access. Any users in the local machine Administrators group will also have access.
The address is not verified when the cmdlet is run. If an incorrect address is
supplied, you will see errors when the other cmdlets are used.
Examples The following example specifies that the PowerShell cmdlets will use the Session
Central Service on the gpweb.conto.com server.
20 P O W E R S H E L L U S E R S G U I D E
U P D A T E - G P S C A L E G R O U P
Update-GPScaleGroup
Description Updates properties for an existing scale group.
• -ScaleGroupName <String>
The new value for the name of the scale group.
• -Description <String>
The new value for the description of the scale group.
• -SetActive [<SwitchParameter>]
If present, sets the scale group to active.
• -SetInactive [<SwitchParameter>]
If present, sets the scale group to inactive.
• -ScaleGroups <ScaleGroup[]>
A list of scale groups to update. This can only be used with the -SetActive and
-SetInactive switch parameters. See examples 3 and 4 for usage.
• <CommonParameter>
This cmdlet supports the common parameters: Verbos, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutButter and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216)
Comments The Update-GPScaleGroup cmdlet accepts the Id of a scale group and the values of
any properties to change. If the parameter for a property is not provided, then the
property will not be changed.
Example 4 sets the status of all scale groups with Id greater than 0 to active. All scale
groups except the the default scale group will be active.
P O W E R S H E L L U S E R S G U I D E 21
U P D A T E -G PS C A L E G R O U P T E N A N T
Update-GPScaleGroupTenant
Description Updates properties for a tenant to scale group assignment.
• -SetActive [<SwitchParameter>]
If present, sets the scale group assignment to active.
• -SetInactive [<SwitchParameter>]
If present, sets the scale group assignment to inactive.
• -Assignments <ScaleGroupTenantAssignment[]>
A list of tenant to scale group assignments to update. See example 2 for usage.
• <CommonParameter>
This cmdlet supports the common parameters: Verbos, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutButter and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216)
Comments The Update-GPScaleGroupTenant cmdlet accepts the tenant name and a switch
parameter to set the scale group assignment to either active or inactive.
Examples Example 1 sets the scale group assignment for Tenant1 to inactive.
Example 2 gets all of the tenants assigned to the scale group with Id 1 and sets them
to inactive.
22 P O W E R S H E L L U S E R S G U I D E
U P D A T E - G P S E S S I O N H O S T
Update-GPSessionHost
Description Updates properties for an existing session host.
• -Description <String>
The new value for the description of the session host.
• -ScaleGroupId <Int32>
The new scale group Id to make the session host a member of.
• -UtilizationRate <Single>
The utilization rate of the session host. Accepted values are 1 to 100 for the
percentage of utilization.
• -SetActive [<SwitchParameter>]
If present, sets the session host to active.
• -SetInactive [<SwitchParameter>]
If present, sets the session host to inactive.
• -SessionHosts <SessionHost[]>
A list of session hosts to update. See example 3 for usage.
• <CommonParameter>
This cmdlet supports the common parameters: Verbos, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutButter and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216)
Comments The Update-GPSessionHost cmdlet accepts the Id of a session host and the values of
any properties to change. If the parameter for a property is not provided, then the
property will not be changed.
Examples Example 1 changes the description of the session host with an Id of SessionHost1.
Example 2 inactivates and changes the utilization rate of the session host with an Id
of SessionHost1.
P O W E R S H E L L U S E R S G U I D E 23
U P D A T E -G PS E S S I O N H O S T
Example 3 activates all of the session hosts that are part of the default scale group.
24 P O W E R S H E L L U S E R S G U I D E
U P D A T E - G P S E S S I O N H O S T T E N A N T
Update-GPSessionHostTenant
Description Set the session host to active or inactive for a tenant.
• -SessionHostId <String>
Specifies the Id of the session host to be updated.
• -SetActive [<SwitchParameter>]
If present, sets the session host to active for the tenant.
• -SetInactive [<SwitchParameter>]
If present, sets the session host to inactive for the tenant.
• -Assignments <SessionHostTenantAssignment[]>
Specifies a tenant to session hosts object to update.
• <CommonParameter>
This cmdlet supports the common parameters: Verbos, Debug, ErrorAction,
ErrorVariable, WarningAction, WarningVariable, OutButter and OutVariable. For
more information, see about_CommonParameters (http://go.microsoft.com/
fwlink/?LinkID=113216)
P O W E R S H E L L U S E R S G U I D E 25
26 P O W E R S H E L L U S E R S G U I D E
Index
C
conventions in documentation 1
D
documentation, symbols and conventions
1
G
GP PowerShell
getting help 5
installing 3
list of commands 5
prerequisites 3
starting 5
H
help, for GP PowerShell cmdlets 5
I
installing, GP PowerShell 3
L
light bulb symbol 1
M
margin notes 1
P
PowerShell 3.0 requirement 3
prerequisites, for GP PowerShell 3
product support for GP PowerShell 1
S
support available for GP PowerShell 1
symbols in documentation 1
T
technical support for GP PowerShell 1
W
warning symbol 1
P O W E R S H E L L U S E R S G U I D E 27