
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 975 Articles for Software & Coding

386 Views
There are several ways to connect to remote computer cmdlets. These computers can be in the same domain, different domains, or for the workgroups using PowerShell. Here, we will mainly focus on the inbuilt parameter, Invoke-Command, and to execute PSSession command remotely.Inbuilt -ComputerName parameter.Many cmdlets in PowerShell supports the -ComputerName parameter, which describes the remote computer names. For example, Get-Service, Get-Process, and Get-WMIObject, etc.. cmdlets.ExampleIf the remote server is in the same domain then you just need to simply add -ComputerName credentials.Get-Service Spooler -ComputerName Test1-Win2k12OutputPS C:\Users\Administrator> Get-Service Spooler -ComputerName Test1-Win2k12 Status Name ... Read More

1K+ Views
As the name describes, with –Timeout parameter, you can restrict time for validations (PowerShell, WinRM, and WMI connectivity check after reboot) for –Wait and –For parameters and if the checks don’t complete during that time then it returns an error. This timeout value is in seconds. You can specify this parameter with either –Wait or –For parameter but with –For parameter you need to include –Wait parameter as well.When -Timeout is specified with –Wait parameter, the overall checks (3 validations: PowerShell, WMI, and WINRM connectivity) then overall check time is restricted in seconds and when it is used with –For ... Read More

310 Views
In the –Wait parameter 3 main checks are validated − PowerShell, WMI, and WINRM connectivity. So whenever you specify the –Wait parameter, you have to wait until all three checks pass, however, if any of the checks fail then script freezes and can not further execute. If you know which specific check you want to perform then you can specify that value with the –For parameter as shown below.Here, for the example, we will run a single WMI check for the remote server.Restart-Computer Test1-Win2k12 -Wait -For Wmi -Force-For parameter must be used with –Wait parameter. Here, again if something goes ... Read More

2K+ Views
When we use Restart-Computer command with the remote computer names, PowerShell restarts the mentioned remote computers without any checks or validations if the server has come up or not. This requirement is fulfilled with the - Wait parameter. Whenever the - Wait parameter specified, PowerShell performs the below 3 checks on the remote computer when the computer is restarting.This can be noticed in the Progress bar of the PowerShell console.PowerShell − If the computer can run the Powershell command on the remote machine.WMI − Performs the WMI query on the remote computer using the Win32_ComputerSystem command.WINRM − Checks the remote ... Read More

3K+ Views
To restart the remote computer, you need to use the Restart-Computer command provided by the computer name. For example, Restart-Computer -ComputerName Test1-Win2k12The above command will restart computer Test1-Win2k12 automatically and if you have multiple remote computers to restart then you can provide multiple computers separated with comma (, ).For example, Restart-Computer -ComputerName Test1-Win2k12, Test2-Win2k12Restart signal will be sent to both the computers at a time in the above example.You can also use the Pipeline to restart remote computers. For example, "Test1-Win2k12", "Test2-Win2k12" | Restart-Computer -VerboseOR(Get-Content C:\Servers.txt) | Restart-Computer -Verbose Few servers have dependencies on the other servers so main servers ... Read More

559 Views
To generate a strong password with the PowerShell, we can use 8 or more characters password. In the below example, we are going to use the 8 character password, you can change the number of characters as per your convenience.This script you can bind into windows forms and provide it to the IT helpdesk to set the password for new users.In this example, we will use the Random integers between 33 and 126 and convert it to the Character, considering them they are the ASCII values for characters.You can find more about ASCII values in the table provided in the ... Read More

2K+ Views
To copy the items with the different credentials you need to use the credential parameter in the Copy-Item cmdlet.For example,Copy-Item C:\temp\* -Destination \Remoteshare\c$\temp -Credential (Get- Credential)Or$creds = (Get-Credential) Copy-Item C:\temp\* -Destination \Remoteshare\c$\temp -Credential $creds

2K+ Views
Now it is easy to ZIP or extract (unzip) the files or folders using PowerShell. PowerShell has added features of the Archive module (Microsoft.PowerShell.Archive) from PowerShell 5.1 version.If you have PowerShell older version (version 4.0 or less) then you can download and install the module from the website or through the command line. However, only download and installing or manually copying the Archive module to the Module folder won’t work because it needs some dependent DLL files which are provided by .Net framework 4.5 so you need to consider upgrading .Net framework as well if it is below the 4.5 ... Read More

4K+ Views
When you are writing a script and if you want to provide the user to select one option among multiple values and based on it to execute the command, we can generally use the Switch command and for it, we will ask the user choice in the below script.There is another .Net method to create a user menu, we will see it after the example from the description mentioned above.a. Switch command methodFor the Switch command-based user selection, we will first display the message for the user and then give him a choice for the selection through Read-Host command as ... Read More

12K+ Views
SSL certificates are a very crucial part of the website. They play a key role in securing the exchange of information on both client and server sides by activating an HTTPS secure connection. In the below article with the PowerShell, we will get the certificate validity date (starting and expiry date) for the certificate using PowerShell.To achieve this, we need to make httpwebrequest but before that, we will ignore SSL warning by the below command.[Net.ServicePointManager]::ServerCertificateValidationCallback = { $true }And then we wil make the HTTP web request by calling a .Net class.$url = "https://www.microsoft.com/" $req = [Net.HttpWebRequest]::Create($url)When we check the ... Read More