Solved

PowerShell: Quick Question About Syntax

Posted on 2013-01-10
3
366 Views
Last Modified: 2013-01-10
I've found a quick script to use as a foundation for a process I want to automate.  In the first line of this script there is a parameter in which I'm having difficulty understanding, specifically the *0* parameter.  The line reads:

Add-Pssnapin *0*

I understand that the script calls PowerShell, but I don't understand the need for *0*.  I'm assuming that it's a wildcard to call any version of PowerShell available, but I don't want to make an uneducated assumption.
0
Comment
Question by:DrivelFree
3 Comments
 
LVL 30

Expert Comment

by:Brad Howe
ID: 38762639
Can you post the entire script?

*0* looks like an argument being passed into the script or a variable within the script.

Add-PSsnapin is relative straight forward.

Add-PSSnapin [-Name] <String[]> [-PassThru] [ <CommonParameters>]
http://technet.microsoft.com/en-us/library/hh849705.aspx

Cheers,
Hades666
0
 
LVL 15

Accepted Solution

by:
Rajkumar-MCITP earned 500 total points
ID: 38762655
Syntax of the Add-PSsnapin will be

Add-PSSnapin [-Name] <String[]> [-PassThru] [ <CommonParameters>]

where the -Name feild is a required one and -Passthru is optional

and the -Name feild will accept wild card charectors

for your question, Add-Pssnapin *0* - I believe it is o and not 0 (zero) and it refers to load any version of powershell
0
 
LVL 40

Expert Comment

by:Subsun
ID: 38762672
It simply says add Pssnapin (PowerShell snap-ins) which contains 0 in name.. For example..
Add-Pssnapin *Power* will load all Pssnapin's which has word power in it's name..

You can use Get-Pssnapin to find available Pssnapin's.
0

Featured Post

Is Your AD Toolbox Looking More Like a Toybox?

Managing Active Directory can get complicated.  Often, the native tools for managing AD are just not up to the task.  The largest Active Directory installations in the world have relied on one tool to manage their day-to-day administration tasks: Hyena. Start your trial today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will help you understand what HashTables are and how to use them in PowerShell.
Marketers need statistics and metrics like everybody else needs oxygen. In this article we explain how to enable marketing campaign statistics for Microsoft Exchange mail.
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
To show how to generate a certificate request in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.:  First we need to log into the Exchange Admin Center. Navigate to the Servers >> Certificates…

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

24 Experts available now in Live!

Get 1:1 Help Now