Latest Questions
Post Top Ad
Your Ad Spot
Saturday, June 15, 2019

25 Top PowerShell Interview Questions and Answers {Updated}

PowerShell Interview Questions and Answers for experienced PDF, Read commonly asked PowerShell Job Interview Questions with Answer PDF for Freshers.


Read PowerShell Interview Questions and Answers

What is PowerShell?
Power shell is an extendable command shell and a scripting language for Windows.

What are the key characteristics of PowerShell?
The key characteristics of PowerShell are
  • PowerShell is object-based and not text-based
  • Commands in PowerShell are customizable
  • It is a command line interpreter and scripting environment

In PowerShell what do variables hold?
In variables, PowerShell contains strings, integers, and objects.  It does not have special variables as it is pre-defined with PowerShell

What is the significance of brackets in PowerShell?
  • Parenthesis Brackets (): Curved parenthesis style brackets are used for compulsory arguments.
  • Braces Brackets {}: Curly brackets are employed in blocked statements
  • Square Brackets []: They define optional items, and they are not frequently used

What does it mean cmdlet’s?
Cmdlet’s are simple build in commands written in .net languages like C# or VB introduced by Windows PowerShell

What is PowerShell Loop?
Automating a repetitive task with the help of PowerShell loop is known as PowerShell Loop.  Through PowerShell, you can execute  For each loop,  While loop and Do While loop.

Explain can you create PowerShell scripts for deploying components in SharePoint?
If you have created a web part using VS 2010 then, you can deploy it using cntrl+f5. However, to activate the web part feature you can write a PowerShell script (.ps1) and execute it after deployment

Explain about the PowerShell’s comparison operators?
Comparison Operators compares the value in PowerShell.  Four types of comparison operators are used equality, match, containment and replace.  In PowerShell, one of the key comparison operators is –eq that is used instead of “=” sign for declaring variables.  Likewise, there are other operators like –ne for “not equal”, -gt ( greater than ) or –lt (less than).

What is PowerShell pipeline is used for?
PowerShell pipeline is used for joining two statements such that the output of one statement becomes the input of the second.

What is PowerShell get-command?
Get command in PowerShell 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
# PowerShell Get-Command Range
Clear-Host
Get-Command [ L–R ]*

Explain with an example how you can map a network drive in PowerShell?
To map a network drive in PowerShell you have to use the command line
# PowerShell Map Network Drive
$Net = $( New – Object – ComObject Wscript.Network )
$Net.MapNetworkDrive( “S:”, \expertPDFS )
In here the drive letter is “S:” and the Network share is called ‘expert’ on a computer called ‘PDFS.’

What are the three ways that PowerShell uses to ‘Select’?
  • The most common way is in a WMI Query Language (WQL) statement. In this technique, Wmiobject uses ‘-query’ to introduce a classic ‘Select * from’ a phrase
  • The second context for ‘Select’ in PowerShell is Select-String. This cmdlet checks for a word, phrase or any pattern match
  • Another way is Select Object

What is the function of Get-ServiceStatus in PowerShell?
The cmdlets of windows enable you to filter the window services.  PowerShell can list which services are ‘Running’ and which are ‘Stopped’ by scripting with windows.

What PowerShell Scripting is?
PowerShell file contains a series of PowerShell commands with each command appearing on a separate line. To use a text file as a PowerShell script, its filename should have.PS1 extension. To run a script you need
  • Type the commands in a text editor
  • Save the file with .ps1 extension
  • Execute the file in PowerShell

What is the use of a hash table in PowerShell?
A hash table is also referred to as a dictionary. It is an array that allows you to store data in a “key-value” pair association. The “key” and “value” can be of any data and length.  To declare a hash table you have to use @ followed by curly braces.

What is the use of Array in PowerShell?
The use of Array in PowerShell is to run a script against remote computers.  In order to create an array, you have to create a variable and assign the array.  Arrays are represented by “@” symbol, they are represented as hashtable but not followed by curly braces.
For example, $arrmachine = @ ( “machine1” , “machine2” , “machine3”)

Mention what is the command that can be used to get all child folders in a specific folder?
To get all child folders in a specific folder, you have to use parameter recurse in the code.
Get-ChildItem C: Scripts –recurse

How you can convert the object into HTML?
To convert the object into HTML
Get-Process l Sort-object – property CPU –descending l convert to – HTML l Out-file “process.html”

How you can rename a variable?
To rename a variable,
Rename-Item- Path Env: MyVariable –NewName MyRenamedVar

What is the function of the $input variable?
The $input variable enables a function to access data coming from the pipeline

What is the code to find the name of the installed application on the current computer?
Get-WmiObject-Class Win32_Product- ComputerName . l Format-wide-column1

How you can find in PowerShell that all the SQL services are on one server?
There are two ways to do this
  • get-wmiobject win32_service l where-object {$_name-like “*sql*”}
  • get-service sql*

Post Top Ad

Your Ad Spot

Pages