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
0
votes
1 answer

Should I implement the IPropertyCmdletProvider interface for a PowerShell Cmdlet?

I'm writing a NavigationCmdletProvider for PowerShell. Through the GetItem and GetChildItems overrides, there are various types of objects that are written to the pipeline. The docs for IPropertyCmdletProvider interface tell us the…
Scott Saad
  • 17,962
  • 11
  • 63
  • 84
0
votes
2 answers

why export-csv returns a file that contains wierd data?

I have a binary cmdlet Get-CustomPSObject. When I do something like: Get-CustomPSObject > a.txt the result is stored as a plain text, meaning that the Get-CustomPSObject is working fine. However when I try: Get-CustomPSObject | Export-csv…
jamesdeath123
  • 4,268
  • 11
  • 52
  • 93
0
votes
1 answer

My cmdlet cannot be registered

basically the code is from msdn.microsoft.com After I build the code, I open the command prompt and type in: Installutil -i %path%/Mycmdlets.dll The result indicates that the Install phase completed successfully and the commit phase completed…
jamesdeath123
  • 4,268
  • 11
  • 52
  • 93
0
votes
3 answers

Backup-WDServer: How to specify encryption password

I read about the Web Deploy Powershell Cmdlets, and I'd like to start using them. Of course, the first task as I begin is to backup the current configuration state of my test webserver--and this cmdlet should do it: Backup-WDServer…
Geoffrey McGrath
  • 1,663
  • 1
  • 14
  • 35
0
votes
1 answer

Escaping single quotes in C# powershell runspace

I am trying to run Exchange cmdlets using System.Automation dll in C#. In http://technet.microsoft.com/en-us/library/dd315325.aspx, they have said that for escaping single quotes, we basically need to append it with another single quote For…
0
votes
1 answer

Azure power shell cmdlet dll in .net project

Here I have a question about how to use Azure power shell cmdlet dll in .net project. I got a look at this thread in msdn: Use powershell cmdlet we can use this command. Remove-AzureVM -ServiceName -Name And this will involve the dll under…
EthenHY
  • 551
  • 3
  • 9
  • 19
0
votes
0 answers

how to execute tsql scripts from cmdlet written in c#

I want to execute tsql scripts from custom cmdlet written in c#. Can you recommend me the best practice to do it? I have a few .sql scripts and in my cmdlet I need to iterate through them in specific order and execute each sql script. I also need to…
zosim
  • 2,959
  • 6
  • 31
  • 34
0
votes
1 answer

How do I change the timeout value for Add-Blob Azure cmdlet?

I'm trying to invoke Add-Blob Azure cmdlet Add-Blob -BlobType Block -FilePath $packagePath -ContainerName $blobContainerName and it has been working just fine until recently but now it fails with Operation could not be completed within the…
sharptooth
  • 167,383
  • 100
  • 513
  • 979
0
votes
3 answers

How can I enable the "Get-VM" Cmdlet?

Is Get-VM native PowerShell cmdlet? I used Get-Command in PS, but could not able to find the cmdlet Get-VM. Is this cmdlet specific to VMware? Is there some PowerShell command I am missing to get these hidden cmdlets?
user1659498
  • 11
  • 1
  • 2
0
votes
2 answers

AppFabric Cmdlet - cannot connect to local cluster

I've been trying to write a simple little Cmdlet to allow me to Set/Get/Remove cache items. The problem I have is that I cannot figure out how to connect to the local cache cluster. I've tried adding in the usual app.config stuff, but that doesn't…
Antony Scott
  • 21,690
  • 12
  • 62
  • 94
0
votes
1 answer

Run entityframework cmdlets from my code

I am creating a small program over entityframework which allows to edit the POCOs with a UI. as part of the process i would like to call the "add-migration" command from my code to save the interaction of the rest of the programmers with the…
Guy
  • 336
  • 4
  • 18
0
votes
1 answer

Reference or documentation for Citrix XenServer Powershell cmdlets

I just started writing powershell scripts for Citrix XenServer. However, I can only find code snippets and this cmdlet poster on the internet. Where can I find a full documentation with explanations and possible parameters directly from Citrix? All…
0
votes
1 answer

How to exclude a folder with remove-item cmdlet

I have a git repository that I'm trying to delete all files and folders out of but not the .git folder. I've tried various permutations of the -exclude parameter but can't seem to get it. $repoPath = "c:\myrepo" Remove-Item $repoPath -Recurse -Force…
Micah
  • 111,873
  • 86
  • 233
  • 325
0
votes
1 answer

Group Policy Event Forwarding through PowerShell - Windows

On windows server, when you open group policy setting (gpedit.msc in System32), I can set up Event Forwarding by following steps here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb870973(v=vs.85).aspx under section Configuring the event…
Saher Ahwal
  • 9,015
  • 32
  • 84
  • 152
0
votes
1 answer

How to know whether parameter "whatif" has been passed to a customer cmdlet programmatically?

I would like to know whether whatif parameter has been passed to a cmdlet. for ex: remove-mycmdlet -whatif I tried to do it by finding the value of the variable: WhatIfPreference. But its always yields false. Can you please let me know how can i…
Dreamer
  • 3,371
  • 2
  • 34
  • 50