- 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
1K+ Views
To validate the file or folder path inside the PowerShell function parameter, we need to use the ValidateScript command. Generally, we write the script as below to validate the path.function Validate-Path{ param( [parameter(Mandatory)] [String]$Path ) if(Test-Path $Path) {Write-Output "Path is valid"} ... Read More
Chirag Nagrekar
1K+ Views
To copy the files using the specific files extension using PowerShell, we can use the Copy-Item command.The below command will copy only the .ps1 files from the source to the destination.For example, PS C:\> Copy-Item -Path C:\Temp -Recurse -Filter *.ps1 -Destination C:\Temp1\ -VerboseIf the C:\Temp1 doesn't exist, it will create ... Read More
Chirag Nagrekar
1K+ Views
To get the disabled local user accounts using PowerShell on the local and the remote system, we can use the WMI or the CIM instance method with the Win32_UserAccount class and the Disabled property to filter the result.PS C:\> gwmi win32_useraccount | where{$_.Disabled -eq $true}You can filter out the properties ... Read More
Chirag Nagrekar
3K+ Views
To create a new local user in the Windows operating system using PowerShell, we can use the New-LocalUser cmdlet. The below command will create the TestUser with no password.New-LocalUser -Name TestUser -NoPasswordOutputName Enabled Description ---- ------- ----------- TestUser TrueTestUser account has been enabled here. To provide the password for the ... Read More
Chirag Nagrekar
3K+ Views
Let say we have one MSI file and we need to install the MSI file on the remote computers using PowerShell but that MSI file should be deployed with the Batch file and should be executed using PowerShell.In this example, we have a 7-zip MSI file and batch file we ... Read More
Chirag Nagrekar
4K+ Views
Azure VM RAM and CPU size depend on the hardware profile chosen for the VM. In this example, we will retrieve VM (TestMachine2k16) hardware profile and then we can find how much RAM or CPU is allocated to it.To get the Size of the Azure VM, PS C:\> $azvm = ... Read More
Chirag Nagrekar
1K+ Views
Once you are connected to the Azure Account, there are possibilities that the Get-AzVM will display the VMs from all the Azure Subscriptions.To find the specific Azure VM Subscription name, we will first retrieve the details of the VM using the Get-AzVM and it has an ID property that contains ... Read More
Chirag Nagrekar
1K+ Views
To retrieve the azure VM resource group using PowerShell, we first need to retrieve the Azure VM details using Get-AZVm and then we can use its property called ResourceGroup.Before getting the details of the Azure VM, make sure that you are connected to the Azure Account using the Connect-AzAccount command.In ... Read More
Chirag Nagrekar
4K+ Views
To eject the USB device from the system, we first need to get the USB device using PowerShell. WMI class Win32_Volume will help us to find the USB device.We know that all removal devices using the DriveType '2'. So we will filter out the USB device among the listed devices.PS ... Read More
Chirag Nagrekar
3K+ Views
To retrieve the USB-connected devices using Powershell, we need to retrieve all the drives using the WMI object or CIM Instance and need to filter the win32_diskdrive class with the USB as shown below.So basically, USB devices and other removable devices have the drivetype '2'. You can search with the ... Read More
To Continue Learning Please Login
Login with Google