Solved

PowerShell: Quick Question About Syntax

Posted on 2013-01-10
3
370 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

A project that enables an administrator to perform actions within a user session context not just at the time of login but any time later on day(s) or week(s) later.
A recent project that involved parsing Tableau Desktop and Server log files to extract reusable user queries for use in other systems. I chose to use PowerShell to gather the data, and SharePoint to present it...
This video discusses moving either the default database or any database to a new volume.
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

696 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