1. What is PowerShell?
Ans: PowerShell is a shell created especially for system administrators. (PowerShell Interview Questions) Open Source and Platform Independent (Windows/Linux/Mac)
Object oriented, not text-based
Built on .NET framework
Interactive prompt and a scripting environment.
2. What do you think is Microsoft PowerShell?
Ans: Microsoft PowerShell is a command-line shell which is scripting language built on .NET. It helps system admins and power-users to rapidly manage OS. (Windows, MacOS and Linux) and processes.
3. Describe what is the significance of brackets in PowerShell?
Ans: Parenthesis Brackets (): Curved parenthesis style brackets are used for compulsory arguments.
Braces Brackets: Curly brackets are defined as employed in blocked statements
Square Brackets: They defined as optional items, and they are not frequently used.
4. Define the key features of PowerShell?
Ans: The main characteristics of Microsoft PowerShell can be summed up as follows.
- PowerShell is a scripting
- PowerShell commands are
The programming language isn’t text-based. It’s object-based.
5. In PowerShell what does variables holds?
Ans: In variables PowerShell contains strings, integers and objects. It does not contain special variables as it is pre-defined with PowerShell.
6. What is $Error and $ForEach variable?
$Error: This variable contains an array of error objects which represents the most recent errors. The most recent error is the first error in the array.
$ForEach: This variable contains the enumerator (should not be confused with the resulting values) of a for each loop. Properties and methods of enumerators can be used on the value of the $ForEach variable. This kind of variable exists only while the for each loop is in running state, and it is deleted once the loop is completed.
7. Explain do you create PowerShell scripts for deploying components in SharePoint?
Ans: If you create a web part using VS 2010 then, you can deploy it using cntrl+f5. anyway, to activate the web part feature you can write a PowerShell script (.ps1) and execute it after deployment.
8. Explain What Is Powershell Get-command?
Ans: Get command in PowerShell defined as it is used to fetch other cmdlets, for example you are looking for cmdlet between letter L and R then your PowerShell get-command will be like.
9. What is your idea about Variable Interpolation?
Ans: When a variable is added to double-quoted strings, then the PowerShell converts the name of that variable through its value. Typically, this feature in PowerShell is derived as variable interpolation.
10. What are $Home and $PID?
Ans: $Home: This variable contains the complete path of the user’s home directory. This variable can be considered as the equivalent of the %homedrive%%homepath% environment variables in windows such as C:Users<UserName.
$PID: This may contain the process identifier of the process which is hosting the current Windows PowerShell session.
11. What are the 4 types of FORMAT commands that can be used to format data?
12. What argument can be used to change an object into a string or convert the property of an object into the string?
Ans: expand is the issue that should be used with the property name to convert an object property simply into a string.
13. What is the variance, in PowerShell, between a function and an “advanced function” ?
Ans: This could be alogic question for an average candidate, but normally, good candidates should know that the only thing that makes a function advanced and unlocks the wonderful tooling which comes with it is : [CmdletBinding()].
an intelligent candidate would be pretty enthusiastic about all the powerful tools enabled by advanced functions. Any PowerShell scripter who strives to build professional-grade tools should be thankful for all the work PowerShell which is doing for us.
14. How do you check what commands have been added after adding the new snapin to powershell?
Ans: Get-Command -pssnapin –> Lists all commands that got added when the snapin was added to the shell.
15. Distinguish Between Convertto-csv And Export-csv Commands?
Ans: ConvertTo-CSV is a one step process that only changes data into csv format and let it remaining data inside the shell Export-CSV is a two step process that not only converts the information into CSV and also writes the output to a CSV format file.
16. Can you explain the uses of PowerShell Array?
Ans: PowerShell Array is benificial to run scripts on remote computers. To create PowerShell Array, users will require to create variable, as well as they will have to assign the PowerShell Array. PowerShell Arrays are expressed with a “@”symbol, and defined as hashtable.
17. What do you understand by Automatic variables?
Ans: Automatic variables are that describe variables that store state data for PowerShell.
These variables are basicly created and maintained by PowerShell itself.
Some of the very common Automatic Variables are as below:
$: This variable contains the last token available in the last line received by the session.
$?: This may contain the execution status of the last operation. Its value is TRUE if the last operation succeeded and FALSE if it failed.
$^: It may contain the first token of the last line received by the session.
18. How do you ping a remote computer with 5 packets by using PowerShell ?
Ans: Again, this is basic stuff. I dont get caught up in ideology, the good old ping.exe is perfectly valid, as long as the candidate knows the option to specify 5 packets.
If you really require the more PowerShAelly Test-Connection, then ask : I just want the command to return $True if the ping is successful and $False if it is not.
19. Differentiate between OMI and CIM?
OMI: It uses WS-MAN where OMI code have the protocol stack od WS-MAN. It supports only new-style MI providers.
It is available on any implementing platform. If something can talk to OMI, it will be determine to talk to NEW WMI as well.
CIM: It defines the standard. It is created by DMTF.
In this case, early versions were developed as OLD WMI actually by Microsoft, but the newest version implemented both in NEW WMI and OMI by Microsoft as well as others.
20. What is PowerShell’s Get-ServiceStatus function?
Ans: The functions of Get-ServiceStatus are not able filtering of window services. PowerShell lists are the services that are ‘Running’, also, the services that are ‘Stopped’ through scripting.
21. Name the the variables makes up in PowerShell?
Ans: Variables contain objects, integers, and strings.
22. Do you explain the hash table functions in PowerShell?
Ans: PowerShell’s hash table will be referred as a dictionary. generally, it is a series that enables users in storing data with a pair association known as “key-value”. Here, both “key”, as well as “value”, might comprise of any length and information. In order to declare hash table users are have to apply @ in front of curly braces.
23. Provide distinction among WinRM and WSMan and DCOM?
WSMan:WS-Management abbreviated as WSMAN or Web Services-Management is basically a Distributed Management task force.
It is an open standard which defines a SOAP-based (full form Simple Object Access Protocol) protocol for the management of its servers, devices, applications and also various Web services.
WinRM: WinRM is derived from Windows Vista and it is for administrators to remotely run management scripts.
It can able to face remote connections by using the WS-Management Protocol.
DCOM: DCOM means Distributed COM.
It is used to connect LIVE objects which are arrive on the remote machine.
The RPC protocol is benfit the designining and for continuous back-and-forth messaging.
It is a network and memory inefficient.
24. You Have A Script Which Uses Read-host To Prompt The User For An Ip Address. You Need To Make Sure The User Inputs A Valid Ip Address. How Would You Do That?
Ans: A great candidate would probably use one of 2 ways :
Dividing the address in 4 elements and try to cast them to a [byte]
A regular expression
A good candidate would use the much easier and more robust method : let the .NET Framework do the hard work and just try to cast the input string to the class.
so, the candidate should know that what we get from Read-Host is a [string].
25. What Are Cmdlet’s?
Ans: Windows PowerShell introduces the intension of a cmdlet which are simple build in commands, written in a .net language like C# or VB.
26. Explain what is PowerShell Loop?
Ans: Automating repetitive task with the help of PowerShell loop is called as PowerShell Loop.by the PowerShell, you can execute For each loop, While loop and Do While loop.
27. Explain What Is Powershell Pipeline Is Used For?
Ans: PowerShell pipeline is used for combined two statements such that the output of one statement becomes the input of the second.
28. Is Powershell is Ready to Replace My Cygwin Shell On Windows?
Ans: PowerShell is defiantly looks powerful tool for windows. The person who worked in heterogeneous environments like Linux, Solaris and Mac OS X and cygwin have differentiate better way. It is nice and very powerful tool environment seems to have been thought out much more than Unix shells as it use of objects instead of text streams. Powershell is the more powerful than standard built-ins of the Unix shells. Note: Using objects is a paradigm shift as distinguish to other environments and it avoids the whole re-parsing at each step where structured data is involved.
29. Explain about the PowerShell’s comparison operators?
Ans: Comparison Operators compares value in PowerShell. Four types of comparison operators are used equality, match, containment and replace. In this, one of the key comparison operators is –eq that is used instead of “=” sign for declaring variables. similarly, there are other operators like –ne for “not equal” , -gt ( greater than ) or –lt (less than).
30. Distinguish between the concept of WMI between Old and new ideas?
Ans: it is used for old-style native code providers and a repository for itself.
Available only on Windows as mentioned.
It has been more or less deprecated which means it’s is not focused on further improvement or development.
it encourages old-style native code providers and a repository, similarly new-style MI providers as discussed.
Available only on Windows as mentioned.
This is the way forward. It has an essentially stateless relationship with the remote machine.
Note: Browse latest Powershell interview questions and powershell tutorial. Here you can check powershell Training details and Powershell training videos for self learning. Contact +91 988 502 2027 for more information.