
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 2039 Articles for Microsoft Technologies

3K+ Views
Hash table in the PowerShell session is created temporarily. It is like a variable, when the session is closed, hash table is deleted automatically. If you want to delete all the values from the hash table at once but retaining the hash table variable, you need to use the Clear() method.We have the hash table below created already.$htable = [Ordered]@{EmpName="Charlie";City="New York";EmpID="001"}PS C:\WINDOWS\system32> $htable Name Value ---- ----- EmpName Charlie City New York EmpID 001To clear the above hashtable, $htable.Clear()If you check the hash table data, it won’t display ... Read More

19K+ Views
You can add values to the hash table and remove values from the hash tables. To add the values to the hash table, you need to use the below format.$hash[""] = ""We have hash table already created here, $htable = [Ordered]@{EmpName="Charlie";City="New York";EmpID="001"}PS C:\WINDOWS\system32> $htable Name Value ---- ----- EmpName Charlie City New York EmpID 001We need to add additional key “Dept” in the above hash table with the value “Technical”.$htable['Dept']="Technical"When you check the output of the above Hashtable, you can see the key-value is appended to the table.PS ... Read More

2K+ Views
There are several ways to create a Hash Table in PowerShell. We will discuss here the standard method @{} for creating the Hash Table.Using @{} MethodYou can use @{} method to create a hash table. Key-Value pair is separated with the Semi-Colon (;). You can only add unique keys. Duplicate keys are not accepted.$htable = @{EmpName="Charlie";City="New York";EmpID="001"}OutputName Value ---- ----- EmpID 001 City New York EmpName CharlieHere, you will not get the output in an ordered fashion. To get the ordered output, you need to write [Ordered] ahead ... Read More

627 Views
Hash table in a PowerShell is constructed with the Key-Value combination. Each key has its own value, so to get the value we need to refer the Key. We don’t need numeric indexing like Array to refer values.This is how the hash table looks like.Name Value ---- ----- EmpName Charlie City New York EmpID 001In the hash table creation, keys and values are separated with Semi-colons (;). In the above example, EmpName, City and EmpID are referred as keys while Charlie, New York ... Read More

2K+ Views
To create or declare an array in PowerShell, there are few methods.You can directly assign values to the variable and separate it by comma (, ) and that variable becomes the variable.For example, $a = "Apple", "Dog", "Cat", "Banana", "Camel"$a is now an array. To access the variable you can use the Indexing method. The first value will be stored at 0, second at 1 and so on.$a[0] will give the output “Apple”, $a[1] will give the output “Dog” and so on. Negative indexing also works in the array. -1 is the last index, -2 is the second last and ... Read More

344 Views
An array is consists of a set of elements of the same data types or the different data types. When the output consists of more than one line then output or stored variable automatically becomes the Array. Its data type is Object[] or ArrayList and base type would be System.array or System.Object.For example, The output of IPConfig is an array.ExamplePS C:\WINDOWS\system32> ipconfig Windows IP Configuration Ethernet adapter Ethernet: Media State . . . . . . . . . . . : Media disconnected Connection-specific DNS Suffix . : Ethernet adapter VirtualBox Host-Only Network: Connection-specific DNS Suffix . : Link-local ... Read More

5K+ Views
You can overwrite the Powershell alias by redefining it. For example, if the alias is created Edit for Notepad.exe and if you want to overwrite it with another program, say wordpad.exe then use the below command.We will overwrite the Edit alias cmdlet with Wordpad.exe using the Set-Alias command. When you close the PowerShell session, it will remove newly created aliases and modified aliases.Set-Alias edit "C:\Program Files\Windows NT\Accessories\wordpad.exe"You cannot overwrite pre-defined aliases. It will throw an exception.For example, when you try to modify dir alias which points to Get-Content, error output will be as below.To remove newly created aliases without closing ... Read More

4K+ Views
PowerShell alias can be created permanently by 2 methods below.a) Import / Export AliasTo export all the aliases, you need to use Export-Alias cmdlet. When you use this command it will ask you the path for the file to import.To export the newly created alias, you need to give alias name and the name for the export, so later you can import it with the same name.In the below example, we have created alias name Edit for the Wordpad and we will export all the aliases with the name Alias1, so the newly created alias will also be stored and ... Read More

575 Views
Anyone can create a new alias which is a shortcut to another command. To create your own alias you need to use Set-Alias cmdlet. Here, we will create a new alias Edit, which will open a Notepad.exe. First, we will check if Edit alias exists or not.$Alias:EditAs this is going to be a new Alias there will be no output for it. Now, we will create new alias by the below command. You can provide any program path and create an alias for it.Set-Alias Edit Notepad.exeJust check if this Edit alias created successfully or not.PS E:\scripts\Powershell> $Alias:Edit Notepad.exeThis new alias ... Read More

399 Views
In PowerShell, you will get all the alias and their commands using Alias: drive as shown below.Dir Alias:OutputHere, Alias: is the drive but surprisingly you will not find it in your operating system. This is the virtual drive and there are other virtual drives as well. You can list all the virtual drives using the below command.Get-Alias will provide the same result.The above output provides the individual alias and their commands for it. But to group them based on their cmdlets, you need to use Group-Object command.Dir Alias: | Group-Object DefinitionOutputYou will see in the output that aliases are listed ... Read More