I just found /n softwares free Powershell NetCmdlets, and after playing with them I love the functionality they bring to the command line. So it raises the question what are your favorite Cmdlets, and how do you use them?
...
Hi,
I have a C# Windows application which runs a service. I would like to leverage PowerShell in order to offer a command line management interface for administering my running service.
From my point of view, I am trying to offer the same administrative interface a la Exchange 2007.
Do you have any suggestion or sample code on how to ...
Hi,
I'm learning some PowerShell. Is it possible to see the source code for a built-in cmdlet like Get-ChildItem?
...
Hi,
I'm currently putting together some Powershell cmdlets. Building them is easy enough but I don't know if I'm building them in an acceptable manner (so to speak).
Are there any guidelines/best practices that one should follow for passing data into the Powershell pipeline? At the moment I'm actually output a single object of type Data...
I have seen several examples on unit testing powershell commandlets in NUnit.
http://www.clydesdalesoftware.net/blogs/jluif/PermaLink,guid,064a378c-85c9-4d2c-9a8d-80620e97f71e.aspx
or
http://www.hanselman.com/blog/TestingPowerShellScriptsWithNUnit.aspx
Does anyone know same way one would unit test powershel commandlets in Visual Studio ...
Hi,
I have a Windows Forms app that provisions user accounts in Exchange using Powershell and Exchange2007 cmdlets. There is only one form to this application that takes the information for the new user and then runs the Powershell commands. Like a good programmer, I just refactored the code and took all the Exchange and Active Director...
Dear Friends,
I am developing a .NET/C# 2.0 application which uses the PowerShell SDK for script execution. I am not using SnapIns. I am setting everything directly through PS's RunspaceConfiguration.
So my problem is that I cannot add a custom format for my type Plux.ExtensionTypeInfo implemented in the application.
( Plux.Extensio...
Approaching cmdlets in a conceptual way,
How are they made? Are they compiled?
Is it the equivalent of a batch file for Powershell? Is it a script or a binary?
What is the structure used for storing these cmdlets?
...
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 DoSomethingCommand : PSCmdlet
...
private MyEnum isEnabled;
[Parameter(Mandatory = false)]
p...
I'm writing a Cmdlet that can be called in the middle of a pipeline. With this Cmdlet, there are parameters that have the ValueFromPipelineByPropertyName attribute defined so that the Cmdlet can use parameters with the same names that are defined earlier in the pipeline.
The paradox that I've run into is in the overridden BeginProcessin...
If I find (or create) a new PowerShell cmdlet (or function), how do I add it to my machine?
Do I copy it to a particular folder?
Do I put its content in a particular file?
Do I need to authorize it, or sign it, or give it permission in some way?
I don't want to use it in just one session, I want it to be available whenever I use Powers...
I'm writing a custom PowerShell cmdlet, and I would like to know which is the proper way to validate a parameter.
I thought that this could be done either in the property set accessor or during Cmdlet execution:
[Cmdlet(VerbsCommon.Add,"X")]
public class AddX : Cmdlet {
private string _name;
[Parameter(
Mandatory=false...
When writing Powershell cmdlets, what is the difference between EndProcessing and StopProcessing? They sound the same, their descriptions are just about the same, and latter doesn't appear in the cmdlet lifecycle documentation.
...
I'm trying to create a cmdlet with the name Invoke-Something.
But I cannot find the member "Invoke" to put in the attribute:
[Cmdlet(VerbsCommon.Invoke, "Something", SupportsShouldProcess = true)]
^^^^^^
What am I missing?
...
I'm writing a C# Cmdlet that needs to get the value of a global script variable.
How do I do it?
I noticed that the Runspace has SessionStateProxy.GetVariable method.
Can I access the runspace from a C# Cmdlet?
Thanks!
...
Say I've got two cmdlets, 'new-foo' and 'do-bar'. Both cmdlets need to authenticate to a service in order to perform their action, and 'do-bar' takes a foo. Today, I can do:
new-foo -host localhost -username user -password password -whateverOtherArgs
And I can do:
do-bar -host localhost -username user -password password -foo myFoo
...
I am trying to connect to a remote sql database and simply run the "select @@servername" query in Powershell. I'm trying to do this without using integrated security. I've been struggling with "get-credential" and "invoke-sqlcmd", only to find (I think), that you can't pass the password from "get-credential" to another Powershell cmdle...
Goal: Provide a web service using Visual Basic or C# or .NET that interacts with the Exchange Management Shell, sending it commands to run cmdlets, and return the results as XML. (Note that we could use any lanaguage to write the service, but since it is a Windows Box and we have Visual Studio 2008, it seemed like easiest solution would ...
I've got two CMDlets that return lists of objects. One returns objects of the type SPSolution, which contains the property Id, the other returns objects of the type SPFeature with a property SolutionId.
Now I want to join/merge this data something like this:
$f = Get-Feature
$s = Get-Solution
$result = <JOIN> $f $s
<ON> $f.So...
Hi to all,
i need to run exchange cmdlets from a c# console application.
i followed with success the guide from http://msdn.microsoft.com/en-us/library/bb332449.aspx but only for the basic command and one parameter.
the cmdlets i need to run is:
Get-MailboxStatistics -server evs | Select servername, StorageGroupName,databasename,@{e...