Articles on Trending Technologies

Technical articles with clear explanations and examples

How to add help in the PowerShell function?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Nov-2020 496 Views

When we write a program, people from a non-programming background often expect to get much possible help related to the program. When we write the function and we declare the parameters, people who are unaware of what kind of input the parameter need, generally search for the help first using the Get-Help command and then they find only the parameters but not the description of it. For example, function TestFunct{    param(       #16 Digit Application ID       [parameter(Mandatory=$true)]       [String]$AppID,       #Date in the Unix Format - 2020-10-31T17:12:10+0530       [String]$Date ...

Read More

How to enable or disable local user on Windows OS using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Nov-2020 4K+ Views

To disable the local user on the windows OS using PowerShell, we can use the Disable-Localuser command provided by the local user name. In the below example, we are going to disable the local user called TestUser.Disable-LocalUser -Name TestUserIf we see the GUI, the user account is disabled.To enable the above user, we can use the Enable-LocalUser command.Enable-LocalUser -Name TestuserTo run the above command on the remote computer, we can use the Invoke-Command method. We need to make sure local user account exist on the remote computer.Invoke-Command -ComputerName Test1-Win2k12, Test1-Win2k16 -ScriptBlock{    Enable-Localuser -Name TestUser }Invoke-Command -ComputerName Test1-Win2k12, Test1-Win2k16 -ScriptBlock{ ...

Read More

How to remove a member from the local group using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Nov-2020 7K+ Views

To remove a member from the local group using PowerShell, we can use the RemoveLocalGroupMember command. This command is available in the module Microsoft.PowerShell.LocalAccounts in and above PowerShell version 5.1.To use this command, we need to provide two parameter values. One is the -Group (Local Group Name) and the second is -Member (Name of the Member to remove). For example, Remove-LocalGroupMember -Group Administrators -Member TestUserThe above command will remove TestUser from the local group Administrators.To use the above command on the remote computer, we need to use Invoke-Command. For example, Invoke-Command -ComputerName Test1-Win2k12, Test1-Win2k16 -ScriptBlock{    Remove-LocalGroupMember -Group "Administrators" -Member ...

Read More

How to create a new local group using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Nov-2020 2K+ Views

To create a new local group on the local or the remote system using PowerShell, we can use the NewLocalGroup command. ExampleNew-LocalGroup -Name "TestGroup" -Description "Test Group"OutputName       Description ----       ----------- TestGroup Test GroupYou can verify it from the Computer Management GUI.To create the local group on the remote systems, you can use Invoke-Command. For example, Invoke-Command -ComputerName Test1-Win2k12, Test1-Win2k16 -ScriptBlock{    New-LocalGroup -Name 'TestGroup' -Description 'New Test Group' }The above command will create a New Local group named ‘TestGroup’ on the remote systems, Test1-Win2k12, and Test1-Win2k16.New-LocalGroup command is available in the module Microsoft.PowerShell.LocalAccounts which is part ...

Read More

How to get the list of local groups using PowerShell?

Chirag Nagrekar
Chirag Nagrekar
Updated on 02-Nov-2020 15K+ Views

To get the local groups on the windows system using PowerShell, you can use the Get-LocalGroup (Module: Microsoft.PowerShell.LocalAccounts) command. This command will list down all the groups on the particular system.If we check the properties of this command, it supports Name, Description, ObjectClass (user or group), PrincipalSource (ComputerName – Local or Remote), SID (Security Identifier).We will select them, PS C:\> Get-LocalGroup | Select Name, Objectclass, Principalsource, sid Name                                              ObjectClass PrincipalSource    SID ----           ...

Read More

Count of distinct sums that can be obtained by adding prime numbers from given arrays in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 31-Oct-2020 330 Views

We are given two arrays containing prime and non prime numbers. The goal is to find the count of distinct sums of pairs of prime numbers in each array. We will do this by making a pair of two primes from each array, take their sum and add them to set sums. In the end the size of the set is the number of distinct sums of primes. Let's understand with examples. Input Arr1[] = { 1, 2, 3 } Arr2[] = { 2, 3, 4} Output Distinct Sums of primes :3 Explanation Prime pairs ...

Read More

Count numbers whose difference with N is equal to XOR with N in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 31-Oct-2020 247 Views

We are a number N. The goal is to find numbers between 0 and N whose difference with N is equal to XOR with N.We will do this by traversing no. from i=0 to i

Read More

Count pieces of the circle after N cuts in C++

Sunidhi Bansal
Sunidhi Bansal
Updated on 31-Oct-2020 215 Views

We are given an integer N which represents the number of cuts applied on a 2D-circle. Each circle divides the circle in two halves. Goal is to find the pieces of the circle after N cuts.Number of pieces= 2 * no. of cutsLet’s understand with examples.Input − N=1Output − Pieces of circle: 2Explanation −Input − N=3Output − Pieces of circle: 6Explanation −Approach used in the below program is as followsWe take N for a number of cuts.Take pieces=1*N.Print the result..Example#include using namespace std; int main(){    int N=2;    Int pieces=2*N;    cout

Read More

How do I change focus to a new popup tab in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 26-Oct-2020 4K+ Views

We can change focus to a new popup tab with Selenium webdriver. The getWindowHandles and getWindowHandle methods are available to handle new popup tabs. The getWindowHandles method stores all the currently opened window handles in Set data structure.The getWindowHandle method stores the window handle of the opened browser in focus. The iterator method is used to iterate over all the window handle ids. We have to add import java.util.Set to accommodate Set and import java.util.List and import java.util.Iterator statements to accommodate the iterator in our code.Selenium driver object can access the elements of the parent window. In order to switch ...

Read More

How to wait until an element no longer exists in Selenium?

Debomita Bhattacharjee
Debomita Bhattacharjee
Updated on 26-Oct-2020 8K+ Views

We can wait until an element no longer exists in Selenium webdriver. This can be achieved with synchronization in Selenium. We shall add an explicit wait criteria where we shall stop or wait till the element no longer exists.Timeout exception is thrown once the explicit wait time has elapsed and the expected behavior of the element is still not available on the page. To check if an element no longer exists on the page, we can take the help of the expected condition invisibilityOfElementLocated.To implement explicit wait conditions, we have to take help of the WebDriverWait and ExpectedCondition class.ExampleCode Implementation.import ...

Read More
Showing 51071–51080 of 61,299 articles
Advertisements