New-Gist


Synopsis

Create a New Gist Object.


Syntax

New-Gist -Path <string[]> [-Description <string>] [-Public] [-WhatIf] [-Confirm]  [<CommonParameters>]

New-Gist [-Description <string>] [-Public] [-WhatIf] [-Confirm] [-IseScriptPane] [-FileName <string>]  [<CommonParameters>]

Aliases

None.


Description

Creates a new Gist Object using the currently authenticated user context.


Parameters

-Confirm
    
    Required?                    false
    Position?                    Named
    Accept pipeline input?       false
    Parameter set name           (All)
    Aliases                      cf
    Dynamic?                     false
    
-Description <string>
    Description of the Gist Object.
    
    Required?                    false
    Position?                    Named
    Accept pipeline input?       false
    Parameter set name           (All)
    Aliases                      None
    Dynamic?                     false
    
-FileName <string>
    The name of the Gist file.
    
    Required?                    false
    Position?                    Named
    Accept pipeline input?       false
    Parameter set name           IseScriptPane
    Aliases                      None
    Dynamic?                     true
    
-IseScriptPane
    Captures the current active ISE Script Pane for the GistFile content.
    
    Required?                    false
    Position?                    Named
    Accept pipeline input?       false
    Parameter set name           IseScriptPane
    Aliases                      None
    Dynamic?                     true
    
-Path <string[]>
    Path to file(s) where the content will be used for the GistFile.
    
    Required?                    true
    Position?                    Named
    Accept pipeline input?       true (ByPropertyName)
    Parameter set name           Path
    Aliases                      FullName
    Dynamic?                     false
    
-Public
    Allows the Gist Object to be viewed by others.
    
    Required?                    false
    Position?                    Named
    Accept pipeline input?       false
    Parameter set name           (All)
    Aliases                      None
    Dynamic?                     false
    
-WhatIf
    
    Required?                    false
    Position?                    Named
    Accept pipeline input?       false
    Parameter set name           (All)
    Aliases                      wi
    Dynamic?                     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

System.String[]

  • Represents text as a sequence of UTF-16 code units.

Outputs

Gist

  • A custom .net object representation of the JSON response from the GitHub API.

Notes

There must be an Authenticated User Context to interact with Gist Objects. The IseScriptPane Parameter Set is only available from within the PowerShell_Ise Application.


Example 1

Creates a new Gist and adds the file ProtectedAttributeCleanup.ps1 to it.

PS C:\> New-Gist -Path .\ProtectedAttributeCleanup.ps1 -Public

Owner       : dotps1
Description : Find users in a domain that have the protected attribute that should not, remove that attribute and re enable inheritance.
Id          : a5b60bdf7955e029a500
CreatedAt   : 2/3/2016 3:20:37 PM
UpdatedAt   : 2/4/2016 11:59:19 AM
Public      : True
HtmlUrl     : https://gist.github.com/a5b60bdf7955e029a500
Files       : ProtectedAttributeCleanup.ps1

Example 2

Creates a new Gist Object and uses the content from the currently active ISE Script Pane Tab as the contents.

PS C:\> New-Gist -IseScriptPane -FileName ProtectedAttributeCleanup.ps1 -Public

Owner       : dotps1
Description : Find users in a domain that have the protected attribute that should not, remove that attribute and re enable inheritance.
Id          : a5b60bdf7955e029a500
CreatedAt   : 2/3/2016 3:20:37 PM
UpdatedAt   : 2/4/2016 11:59:19 AM
Public      : True
HtmlUrl     : https://gist.github.com/a5b60bdf7955e029a500
Files       : ProtectedAttributeCleanup.ps1
Fork me on GitHub