- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Chirag Nagrekar has Published 465 Articles
Chirag Nagrekar
21K+ Views
To install the MSI file with PowerShell, we can use cmdlet Start-Process.Let say we want to install the 7ZIP MSI file on the local computer and we have downloaded and stored the source file on the C:\temp location. Once we run the below command it will start the MSI installation.Start-Process ... Read More
Chirag Nagrekar
28K+ Views
To add the AD user or the local user to the local Administrators group using PowerShell, we need to use the Add-LocalGroupMember command.To add the local user to the local Administrators group, Add-LocalGroupMember -Group Administrators -Member TestUser -VerboseThe above command will add TestUser to the local Administrators group. You can ... Read More
Chirag Nagrekar
25K+ Views
To count the total number of lines in the file in PowerShell, you first need to retrieve the content of the item using Get-Content cmdlet and need to use method Length() to retrieve the total number of lines. An example is shown below.Example(Get-Content D:\Temp\PowerShellcommands.csv).LengthOutputPS C:\WINDOWS\system32> (Get-Content D:\Temp\PowerShellcommands.csv).Length 5727Read More
Chirag Nagrekar
26K+ Views
To change the azure subscription using PowerShell, we can use the Select-AZSubscription command. When you use this command, you can use either the subscription ID, Subscription Name, or the Tenant ID.ExampleWith Subscription Name, Select-AzSubscription -SubscriptionName 'Visual Studio'With TenantID, Select-AzSubscription -Tenant 'XXXX-XXXXX-XXXXXXX-XXXX'With Subscription ID, Select-AzSubscription -SubscriptionId 'XXXX-XXXXX-XXXXXXX-XXXX'Sometimes on console messages will ... Read More
Chirag Nagrekar
29K+ Views
An array is always a fixed size. To add value to the array, you need to create a new copy of the array and add value to it. To do so, you simply need to use += operator.For example, you have an existing array as given below.$array = 1, 2, ... Read More
Chirag Nagrekar
31K+ Views
To get the Windows System uptime with PowerShell, we can use the CIM Instance method with class name Win32_OperatingSystem. Once you use the mentioned class there is a property called LastBootupTime which shows the date when the computer is last rebooted.ExampleGet-CimInstance -ClassName Win32_OperatingSystem | Select LastBootUpTimeOutputLastBootUpTime -------------- 9/29/2020 8:12:08 AMIf ... Read More
Chirag Nagrekar
32K+ Views
To get the full path of the script we need to use the $myInvocation command. This is an automatic variable and it is only invoked when the script or the function is executed.$MyInvocation.MyCommand.Path command is useful to get the full path of the script where it resides while $MyInvocation.MyCommand.Name is ... Read More
Chirag Nagrekar
34K+ Views
To get the local Administrators group members using PowerShell, you need to use the GetLocalGroupMember command. This command is available in PowerShell version 5.1 onwards and the module for it is Microsoft.PowerShell.LocalAccounts. This module is not available in the 32-bit PowerShell version but on a 64-bit system.In the below example, ... Read More
Chirag Nagrekar
38K+ Views
As of now, there is no built-in command like CSV (Export-CSV) to export output to the excel file but we can use the Out-File command to export data to excel or any other file format.Let’s use Out-File to export the output of the Get-Processes command to an excel file.Get-Process | ... Read More
Chirag Nagrekar
43K+ Views
To delete the registry key using PowerShell, we can use the Remove-Item command. Remove-Item command removes the registry key from the path specified. For example, we have the registry key name NodeSoftware stored at the path HKLM, under the Software key.To delete the key we will use the below command.Remove-Item -Path HKLM:\SOFTWARE\NodeSoftware -Force -VerboseWe ... Read More