Questions tagged [powershell-cmdlet]

Quote from Microsoft site: "A cmdlet is a lightweight command that is used in the PowerShell environment. The PowerShell runtime invokes these cmdlets within the context of automation scripts that are provided at the command line. The PowerShell runtime also invokes them programmatically through PowerShell APIs"

Ref: Cmdlet Overview

882 questions
6
votes
2 answers

How to extract specific tables from html file using native powershell commands?

I make use of the PAL tool (https://pal.codeplex.com/) to generate HTML reports from perfmon logs within Windows. After PAL processes .blg files from perfmon it dumps the information into an HTML document that contains tables with various data…
Tom A.
  • 125
  • 1
  • 2
  • 7
6
votes
2 answers

How to add synopsis/summary for a cmdlet in C#?

Suppose you are writing some PSCmdLet in C#: /// /// Get a stack overflow exception. /// [Cmdlet(VerbsCommon.Join, "StackOverflow")] [OutputType(typeof(OverflowException))] public class JoinStackOverflow : PSCmdlet { protected…
Rok Strniša
  • 6,781
  • 6
  • 41
  • 53
6
votes
2 answers

Azure Cmdlets: String was not recognized as a valid Boolean

I am using Start-AzureWebsite (as well as Stop-AzureWebsite) azure powershell cmdlet to start azure website. It was working for about 3 months and stopped working 2 days ago (January 31, 2014) (without any changes to environment). Now both cmdlets…
petro.sidlovskyy
  • 5,075
  • 1
  • 25
  • 29
6
votes
1 answer

How to find which Cmdlet Alias was used by user?

Please excuse me if you find this a very lame questions, but since I am learning Powershell I need to ask. This is a sort of next part of the question posted and answer received here. I have a custom cmdlet named Get-DirectoryListing and I added an…
digitguy
  • 1,014
  • 2
  • 12
  • 29
6
votes
6 answers

How do I determine if a PowerShell Cmdlet parameter value was specified?

In PowerShell 1.0, if I have a cmdlet parameter of an enum type, what is the recommended method for testing whether the user specified that parameter on the cmdlet command line? For example: MyEnum : int { No = 0, Yes = 1, MaybeSo = 2 } class…
Jack Straw
  • 293
  • 5
  • 9
5
votes
1 answer

Powershell C# Cmdlet with Hashtable/Dictionary parameters

Can anyone tell me how to add a parameter to my custom C# cmdlets which is a Hashtable/StringDictionary, so that I can call my cmdlet in a way which resembles this: CustomCmdlet -File $someFilePath ` …
Christian Mikkelsen
  • 1,661
  • 2
  • 19
  • 44
5
votes
1 answer

How to make readonly members in powershell?

How do I make members readonly when I use Add-Member cmdlet in Powershell? Basically, I want to add-member to a System.Diagnostic.Process which has a readonly property.
Bill
  • 5,263
  • 6
  • 35
  • 50
5
votes
2 answers

Create PowerShell Cmdlets in C# - Pipeline chaining

I have some classes in C# which I would like to use them in pipelines, I've seen articles about it but I haven't been able to do it yet. Here's how I am using it right now: $suite = [MyProject.SuiteBuilder]::CreateSuite('my house') $houseSet =…
Ertan Hasani
  • 797
  • 1
  • 18
  • 37
5
votes
2 answers

Powershell Cmdlet.ShouldProcess Method default answer

I have a powershell script in which I have implemented the should process method with a high ConfirmImpact to ensure a prompt occurs. Prompting is working as expected however the default response when nothing is entered is "Y" [Y] Yes [A] Yes to…
5
votes
1 answer

Powershell - Cannot convert value of type "System.Management.Automation.PSCustomObject" to type "System.Management.Automation.PSCustomObject"

I am working with Powershell 4 under Windows 7 and I have cmdlet defined like this: Function Transfer-File { [CmdletBinding()] Param( [Parameter(Mandatory=$true)] [System.Management.Automation.PSCustomObject] …
5
votes
2 answers

Writing multiple cmdlet xml-based help files to a single xml file

The resources for writing xml help files for advanced functions seems very limited. I'm hoping to use xml-based help files, but it seems that this requires me to have one xml file per cmdlet, which is a huge number of xml files. Each cmdlet uses…
Trevor Jordy
  • 598
  • 1
  • 7
  • 27
5
votes
1 answer

"The Azure PowerShell session has not been properly initialized" error message in Octopus

I am trying to run the Get-AzureRmEventHubNamespaceKey cmdlet in an Azure Powershell step within Octopus. I am getting the following error: Get-AzureRmEventHubNamespaceKey : The Azure PowerShell session has not been properly …
5
votes
3 answers

A PowerShell cmdlet vs. a .NET class

When writing a PowerShell script, two options are available: Call a cmdlet Use the .NET Framework Class library In the background, cmdlets are more than probably making use of the .NET library. Which of both is better to use in a Powershell…
Spack
  • 464
  • 4
  • 22
5
votes
2 answers

Cmdlets not found in command line but available in ISE

I'm trying to create an IIS application and app pool using PowerShell on a Windows Server 2008 R2 VM. The powershell script is as follows: Param( [string] $branchName, [string] $sourceFolder ) if (-NOT ([Security.Principal.WindowsPrincipal]…
Adamon
  • 484
  • 9
  • 21
5
votes
4 answers

combine multiple powershell cmdlet outputs

I have a requirement to combine outputs of multiple Power Shell scripts to be given as pipeline output using CmdLets in .NET. For example : Command-GetA -combine Command-GetB | Command-GetD So I want to send outputs of GetA and GetB to GetD via…
Seeker
  • 297
  • 5
  • 19