< Back
Invoke-NexusScript
Post
NAME Invoke-NexusScript
SYNOPSIS
Invokes a Nexus script.
SYNTAX
Invoke-NexusScript [-Uri] <String> [-Credential] <PSCredential> [-Script] <String> [<CommonParameters>]
DESCRIPTION
Invokes a Nexus script.
PARAMETERS
-Uri <String>
Uri of the Nexus repository server (for example https://nexus.myorg.local).
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Credential <PSCredential>
User credentials that have permission to execute the script.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Script <String>
The Groovy script to execute.
Required? true
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
The basic code of this function was borrowed from the chocolatey-nexus-repo package
(https://chocolatey.org/packages/chocolatey-nexus-repo). Credit to Stephen Valdinger and Paul Broadwith.
For a list of the repository API calls see
https://github.com/sonatype/nexus-publi ... natype/nex
us/script/plugin/RepositoryApi.java
Nexus 3 REST and API reference https://help.sonatype.com/repomanager3/ ... ration-api
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>$creds = Get-Credential
$script = @"
import org.sonatype.nexus.repository.Repository;
repository.createNugetHosted("myRepo","default");
"@
Invoke-NexusScript -Uri 'http://localhost:8081' -Credential $creds -Script $script
Invokes the contents of $script on the Nexus repository server 'http://localhost:8081' using the credential $creds.
RELATED LINKS
https://github.com/pauby/NexusManagemen ... sScript.md
SYNOPSIS
Invokes a Nexus script.
SYNTAX
Invoke-NexusScript [-Uri] <String> [-Credential] <PSCredential> [-Script] <String> [<CommonParameters>]
DESCRIPTION
Invokes a Nexus script.
PARAMETERS
-Uri <String>
Uri of the Nexus repository server (for example https://nexus.myorg.local).
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Credential <PSCredential>
User credentials that have permission to execute the script.
Required? true
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-Script <String>
The Groovy script to execute.
Required? true
Position? 3
Default value
Accept pipeline input? false
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
OUTPUTS
NOTES
The basic code of this function was borrowed from the chocolatey-nexus-repo package
(https://chocolatey.org/packages/chocolatey-nexus-repo). Credit to Stephen Valdinger and Paul Broadwith.
For a list of the repository API calls see
https://github.com/sonatype/nexus-publi ... natype/nex
us/script/plugin/RepositoryApi.java
Nexus 3 REST and API reference https://help.sonatype.com/repomanager3/ ... ration-api
-------------------------- EXAMPLE 1 --------------------------
PS C:\\>$creds = Get-Credential
$script = @"
import org.sonatype.nexus.repository.Repository;
repository.createNugetHosted("myRepo","default");
"@
Invoke-NexusScript -Uri 'http://localhost:8081' -Credential $creds -Script $script
Invokes the contents of $script on the Nexus repository server 'http://localhost:8081' using the credential $creds.
RELATED LINKS
https://github.com/pauby/NexusManagemen ... sScript.md