
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

1K+ Views
To start the specific task of the task scheduler using PowerShell, we need to use the Start-ScheduledTask command.When we run the above command, we need to provide the task name.For example, Start-ScheduledTask -TaskName 'FirstTask'When you check the above task status, ExampleGet-ScheduledTask -TaskName 'FirstTask'Output:TaskPath TaskName State -------- -------- ----- \ FirstTask RunningTo start the task on the remote computer, we first need to connect to the CIMSession of the remote computer and we can use the below command.$sess = New-CimSession -ComputerName Test1-Win2k12 Get-ScheduledTask -CimSession $sess -TaskName 'FirstTask' | Start-ScheduledTaskWe can also start the task directly with the command, Start-ScheduledTask using the CIMSession.Start-ScheduledTask -TaskName 'FirstTask' -CimSession $sessRead More

17K+ Views
To retrieve the existing tasks in the task scheduler using PowerShell, we can use the PowerShell command Get-ScheduledTask. We can use the Task Scheduler GUI to retrieve the scheduled tasks. To retrieve using PowerShell, use the Get-ScheduledTask command.When we use the above command, it retrieves all the tasks from the different paths/folders as well including the root path. To retrieve tasks created at the root path we need to filter the task path, Get-ScheduledTask | where{$_.TaskPath -eq "\"}If we need to retrieve the specific task then we need to filter the task name, TaskPath TaskName ... Read More

931 Views
There are two methods to install PowerShell modules. Online and Offline.Online MethodThis method is just like downloading the online package through Yum in the Unix system.We first need to search the package available on the internet using the Find-Module command. You can use the wildcard character if you don’t know the full module name. All the packages are downloaded from PowerShell Gallery (https://www.powershellgallery.com/).For example, if you want a Vmware PowerCLI module and you don’t know the full module name then just use the part of the name inside the Wildcard character(*).Find-Module *vmware* | Select Name, Version, RepositoryName ... Read More

1K+ Views
Javascript Object Notation (JSON) is the light-weight structure which is easy to read by human and simple to parse and understand by machine. Although the name contains the Javascript, both Javascript and JSON are different and they have syntax and structure is different as well.You can get more information about JSONhttps://www.json.org/json-en.htmlIts basic structure is Key-Value pair but both are separated by a colon ‘:’. It has an almost similar structure as a hashtable, PSCustomObjecct. For example, { "Name": "Albert Don" }If you have multiple Key-Value pairs, you can separate them with a comma. For example, { "Name": "Albert ... Read More

548 Views
In PowerShell when you create a complex script or function then it should be essential to create help for the end-users to easily understand your script functionality. Writing comment-based help or XML-based help, at the end is similar to Get-Help syntax for cmdlets or function which is the online version of help.For Example, Just open the PowerShell console and run the command below.Get-Help Get-WmiObjectAnd you can see the various help sections in the output like NAME, SYNOPSIS, SYNTAX, DESCRIPTION, PARAMETER, LINK. These are called Keywords. We can include all of them in the script of function manually to get the ... Read More

4K+ Views
We can remove connected RDP sessions using PowerShell and for that, we can use the cmd command “reset session” in PowerShell. Let’s see the supported parameters for it.ExamplePS C:\> reset session /? Reset the session subsytem hardware and software to known initial values. RESET SESSION {sessionname | sessionid} [/SERVER:servername] [/V] sessionname Identifies the session with name sessionname. sessionid Identifies the session with ID sessionid. /SERVER:servername The server containing the session (default is current). /V Display additional information.We can provide here session ... Read More

3K+ Views
To get the user sessions on the remote computers using PowerShell, we need to use the cmd query command. First of all, we will get the user sessions on the local computer using the below command.Examplequery sessionOutputLet’s see what are other supported parameters for the query session command.ExamplePS C:\> query session /? Display information about Remote Desktop Services sessions. QUERY SESSION [sessionname | username | sessionid] [/SERVER:servername] [/MODE] [/FLOW] [/CONNECT] [/COUNTER] [/VM] sessionname Identifies the session named sessionname. username Identifies the session ... Read More

1K+ Views
Like any other data type conversion in PowerShell, we can convert Dictionary to hashtable in a similar way. We have a below Dictionary for the example called $CityData.Key Value --- ----- India 91 Austria 43Its datatype is Dictionary,ExamplePS C:\> $citydata.GetType() | ft -AutoSizeOutputIsPublic IsSerial Name BaseType -------- -------- ---- -------- True True Dictionary`2 System.ObjectTo convert it to the hashtable,$hash = [Hashtable]$citydataOr$hash = [System.Collections.Hashtable]$CityDataDatatype:PS C:\> $hash | ft -AutoSizeOutputName Value ---- ----- Austria 43 India 91

1K+ Views
PowerShell programmers generally prefer the Hashtable over the Dictionary although there are some advantages of using Dictionary. See the difference below.a. Hashtable is easy to declare while the Dictionary is a little complex compared to Hashtable. For example, To create a hashtable, $hash = @{ 'Country' = 'India' 'Code' = '91' }To create a Dictionary, $citydata = New-Object System.Collections.Generic.Dictionary"[String, Int]" $citydata.Add('India', 91) b. Hashtable is included in the namespace called Collections while Dictionary is included in the namespace called System.Collections.Generic namespace. Hashtable is non-generic so it can be a collection of different data types and Dictionary belongs to a generic class so it is ... Read More

12K+ Views
To create a dictionary in the PowerShell we need to use the class Dictionary from the .Net namespace System.Collections.Generic. It has TKey and TValue. Its basic syntax isDictionaryTo learn more about this .Net namespace check the link below.https://docs.microsoft.com/en-us/dotnet/api/system.collections.generic.dictionary-2?view=net-5.0To create a dictionary we will first create the object for the dictionary object class with the datatypes. In the below example, we need to add the Country name and the country code. So we need String and Int.$countrydata = New-Object System.Collections.Generic.Dictionary"[String, Int]"Once we check the type of the $countrydata variable, it should be the dictionary. For example, ExamplePS C:\> $Countrydata.GetType() | ft -AutoSizeOutputIsPublic ... Read More