Powershell Help system usage - powershell

I am learning powershell, so first i am learning how to use the help system of powershell. Below is the help for command "Get-EventLog",
what do we mean by : Position? named
Also is there any links to get more on how to use the help system
provided by powershell?
Synopsis
Gets the events in an event log, or a list of the event logs, on the local or remote computers.
Syntax Get-EventLog [-LogName] <String> [[-InstanceId] <Int64[]>] [-After <DateTime>] [-AsBaseObject <SwitchParameter>] [-Before <DateTime>] [-ComputerName <String[]>] [-EntryType <String[]>] [-Index <Int32[]>] [-Message <String>] [-Newest <Int32>] [-Source <String[]>] [-UserName <String[]>] [<CommonParameters>]
Get-EventLog [-AsString <SwitchParameter>] [-ComputerName <String[]>] [-List <SwitchParameter>] [<CommonParameters>]
Parameters
-After <DateTime>
Gets only the events that occur after the specified date and time. Enter a DateTime object, such as the one returned by the Get-Date cmdlet.
Required? false
Position? named
Default value
Accept pipeline input? false
Accept wildcard characters? false
-InstanceId <Int64[]>
Gets only events with the specified instance IDs.
Required? false
Position? 2
Default value
Accept pipeline input? false
Accept wildcard characters? false
-LogName <String>
Specifies the event log. Enter the log name (the value of the Log property; not the LogDisplayName) of one event log. Wildcard characters are not permitted. This parameter is required.
Required? true
Position? 1
Default value
Accept pipeline input? false
Accept wildcard characters? false

For #1, you need to understand how positional parameters are used in PowerShell. You can refer to the following scripting guys article on that.
http://blogs.technet.com/b/heyscriptingguy/archive/2012/04/22/the-problem-with-powershell-positional-parameters.aspx
For #2, in PowerShell v3, there is update-able help. By default, on PowerShell 3.0 systems, there is no help installed. Everything is online. You can download the help content using Update-Help and Save-Help cmdlets.
Also, Get-Help <cmdletname> -Online shows the online (most up-to-date) content for any cmdlet.
You can use the about topics in PowerShell to learn the concepts. These about topics can be accessed using help about*. You will see a huge list of topics which can be accessed using help or Get-Help. For example,
help about_Parameters
Once again, if you are using PowerShell 3.0, you need to update the help first to be able to see any help content.

You can first have a look to about_Command_Syntax
get_help about_Command_Syntax
Then have a look at a few other abouts, if you want to add your own help to your Cmd-Lets have a look here.

Related

How to view categories in Powershell v5?

im running powershell v5 on my machine and i can't seem to run the command
GET-HELP -Category Provider.
Is there an alternative to this command which can be used in v5 or is it a command that's available to v3 Powershell?
While Provider is a valid category for help topics, none of the topics that ship with PowerShell use category Provider (anymore), as of Windows PowerShell 5.1 / PowerShell (Core) 7.2.x
See GitHub issue #8030
The next best thing is to use a wildcard-based search, using the Get-Help's (positionally implied) -Name parameter:
Get-Help *provider*
This will list all topics with the word provider in the name, which comprises both cmdlets with the word in the name and conceptual help topics (topics whose name starts with about_).
If you want to limit the output to matching conceptual help topics (as Get-Help -Category Provider may have done in Windows PowerShell versions prior to v5.1):
Get-Help *provider* -Category HelpFile
# Alternative:
Get-Help about_*provider*
[1] The valid categories are: Alias, All, Class, Cmdlet, Configuration, DefaultHelp, DscResource, ExternalScript, FAQ, Filter, Function, General, Glossary, HelpFile, Provider, ScriptCommand, which correspond to the values of a non-public enumeration type, System.Management.Automation.HelpCategory; you can obtain these values programmatically with (TabExpansion2 'Get-Help -Category ' -cursorColumn 19).CompletionMatches.CompletionText.
The topics that ship with Windows PowerShell v5.1 / as of PowerShell (Core) 7.2.x span the following categories: Alias, Cmdlet, ExternalScript, Filter, Function, HelpFile, as obtained with (Get-Help *).Category | % ToString | Sort-Object -Unique
Using Windows Powershell 5.1. when I look at help Get-Help -full, I read the following:
Parameters
-Category <System.String[]>
Displays help only for items in the specified category and their aliases. Conceptual articles are in the HelpFile category.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
If I do a Get-Help * | Group-Object Category | Select-Object Name, I only see the following categories:
Alias
Function
ExternalScript
Cmdlet
HelpFile
I get the same categories in PowerShell v7.2

PowerShell script to modify Azure data factory trigger time

I am wondering if there is any PowerShell script which can help to modify the timestamp of the existing ADF trigger. I want to change the time of my pipeline trigger in UAT as we don't have permission to do that manually from portal.
Set-AzDataFactoryV2Trigger
[-Name] <String>
[-DefinitionFile] <String>
[-ResourceGroupName] <String>
[-DataFactoryName] <String>
[-Force]
[-DefaultProfile <IAzureContextContainer>]
[-WhatIf]
[-Confirm]
[<CommonParameters>]
The Set-AzDataFactoryV2Trigger cmdlet creates a trigger in a data factory. If you specify a name for a trigger that already exists, the cmdlet prompts for confirmation before replacing the trigger. If you specify the Force parameter, the cmdlet replaces the existing trigger without prompting for confirmation. Triggers are created in the 'Stopped' state, meaning that they don't immediately begin invoking pipelines that they reference.
Refer this official documentation for sample example and syntax.

Is property or field 'ServerRelativeUrl' part of the command Get-PnPFolderItem

I am getting the following error while using the command "Get-PnPFolderItem"
Get-PnPFolderItem : The property or field 'ServerRelativeUrl' has not been initialized. It has not been requested or the request has not been executed. It may need to be explicitly requested.
I checked the documentation and there is no reference of it
Get-PnPFolderItem
[-FolderSiteRelativeUrl <String>]
[-ItemType <String>]
[-ItemName <String>]
[-Web <WebPipeBind>]
[-Connection <SPOnlineConnection>]
Per my test, the command "Get-PnPFolderItem" works fine on my environment. So, yes it should be part of the command Get-PnPFolderItem.
Please maek sure the version of your SharePointPnPPowerShellOnline is the lastest. Also try to connect another site and check if it works.

Why is New-SelfSignedCertificate is missing parameter -Type?

I try to sign my ps.1 file and wanted to create a code signing certificate but my New-SelfSigningCertificate does not have the parameter -Type in the function.
I use PowerShell 5.1.
When I use Get-Help, the description oddly enough also displays much less parameters than on the microsoft website. Opening the online help via Get-Help does not work because the URI is not specified.
The Help content:
SYNTAX
New-SelfSignedCertificate [-DnsName <string[]>] [-CloneCert <Certificate>]
[-CertStoreLocation <string>] [-WhatIf] [-Confirm] [<CommonParameters>]
Am I using an outdated version? Is this command only properly available in Win 10 or Server 2016?

Cmdlet in PowerShell to know the OutputFiles generated by a ADLA JOB

Is there a cmdlet in PowerShell to know the OutputFiles generated by a ADLA JOB.
The following CMDLET does not seem to offer that information:
Get-AzureRmDataLakeAnalyticsJob [-Account] <String> [-JobId] <Guid> [[-Include] <ExtendedJobData>] [<CommonParameters>]
Thanks,
Ankit
Currently, there isn't a direct way of via any of the cmdlets to enumerate the inputs or outputs of a job. It could be derived though by looking at the algebra.xml that each job produces.
We are building an REST API/SDK methods/cmdlet that would provide this list of inputs and outpus. This feature will arrive before sometime between now (June 2017) and December 2017.