ITMS Administrator Group

 View Only

Altiris ASDK PowerShell Module 

Aug 02, 2016 03:50 PM

What is this?

The Administrator Software Development Kit (ASDK) is a set of application programming interfaces (APIs) that access the functionality of Notification Server (NS), Site Servers (previously called Task Servers), and various NS solutions.

What I have built here is a PowerShell module that maps out the various web services provided by the ASDK for the following purposes:

  • Ease of learning
  • Quick prototyping
  • Ease of scripting
  • Community improvement of ASDK documentation and examples

​I am not sure if it is just me or everyone who experiences frustration with the lack of good examples provided in the current ASDK help files and the frustration of needing to have the help file open and cross referencing it while attempting to code up a solution.

The PowerShell module takes the ASDK documentation and merges it with the web services available making it easy to learn and easy to find the services and API you are looking for.

 

Getting Started

 

Installation

 

PowerShell v5 or Package Management Installed

Install-Module PoshAltiris

Manual Installation

  1. Download the module from the Github repository
  2. Install the module according to PowerShell module installation instructions

# Note: This will be made easier once we publish the module to the PowerShell Gallery. We are working on this at the moment.

Listing available commands

There are currently 228 cmdlets available in the module they can be viewed using the following command:

Get-Command -Module PoshAltiris

 

Finding commands specific to what you are trying to do, say work with package commandlines, is as simple as the following:

PS C:\> Get-Command *commandline* -Module PoshAltiris

CommandType     Name                                               Version    Source                                                  
-----------     ----                                               -------    ------                                                  
Function        Add-CommandLineToSoftwareComponent                 0.0        PoshAltiris                                             
Function        Get-CommandLine                                    0.0        PoshAltiris                                             
Function        New-CommandLine                                    0.0        PoshAltiris                                             
Function        Remove-CommandLine                                 0.0        PoshAltiris                                             
Function        Remove-CommandLineFromSoftwareComponent            0.0        PoshAltiris                                             
Function        Set-CommandLineProperty                            0.0        PoshAltiris                                             

 

Getting help for specific commands

The ASDK help file for the various methods on the various web services has been integrated into PowerShell help, so standard help commands can be run to view the documentation.

PS C:\> Get-Help Set-CommandLineProperty -Full

NAME
    Set-CommandLineProperty
    
SYNOPSIS
    Set software command line property.
    
SYNTAX
    Set-CommandLineProperty [-CommandLineGuid] <Guid> [-PropertyName] <String> [-PropertyValue] <String> [-Server] <String> 
    [[-Credential] <PSCredential>] [<CommonParameters>]
    
    
DESCRIPTION
    

PARAMETERS
    -CommandLineGuid <Guid>
        GUID of software command line
        
        Required?                    true
        Position?                    1
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -PropertyName <String>
        name of property. Valid properties are: Name, Description, CommandLine, CommandLineType, IsDefault, SuccessCodes, 
        FailureCodes, PackageGuid
        
        Required?                    true
        Position?                    2
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -PropertyValue <String>
        The property value is passed into the method as a string, appropriate conversion will then be performed on that string. The 
        value CommandLineType should be a Guid, IsDefault is a bool value so it should be "true" or "false", and PackageGuid should 
        be a Guid.
        
        Required?                    true
        Position?                    3
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Server <String>
        
        Required?                    true
        Position?                    4
        Default value                
        Accept pipeline input?       false
        Accept wildcard characters?  false
        
    -Credential <PSCredential>
        
        Required?                    false
        Position?                    5
        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 (http://go.microsoft.com/fwlink/?LinkID=113216). 
    
INPUTS
    
OUTPUTS
    
    -------------------------- EXAMPLE 1 --------------------------
    
    PS C:\>set failure codes for command line
    
    
    CopyC#
    SoftwareCommandLineManagementLib managementLib = new SoftwareCommandLineManagementLib();
    bool bResult = managementLib.SetCommandLineProperty(cmdLineGuid, "FailureCodes", "1,2,3,4,5");
    CopyVBScript
    set managementLib = CreateObject("Altiris.ASDK.SMF.SoftwareComponentManagement")
    bResult = managementLib.SetCommandLineProperty(cmdLineGuid, "FailureCodes", "1,2,3,4,5")
    Copy? 
    set SMF=AltirisASDKSMF.exe
    set CMDLINE_GUID={A7B8BACC-D63B-466e-ABF6-2DC763CEBB6B}
    %SMF% cmd:SetCommandLineProperty "CommandLineGuid:%CMDLINE_GUID%" "PropertyName:FailureCodes" "PropertyValue:1,2,3,4,5"
    echo Failure Codes changed
    Remarks
    The CLI is being deprecated. Please see the CLI Programming Guide.
    
    
    
    
    
    
RELATED LINKS

 

 

Contributions

Contributions are welcome! I would love for any of you to submit a pull request to the main branch in Github.

 

 

Suggestions / Bugs

If you have any suggestions or bugs with the program please submit them as issues here:

https://github.com/Tiberriver256/PoshAltiris/issues

Statistics
0 Favorited
10 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.