Menu

Programming

You can add a user into a group using active directory users and computer (ADUC) mmc snap in or by executing a single PowerShell cmdlet. In this article, we'll look into adding a member to the AD group using PowerShell.

You can use the PowerShell add-content cmdlet to append data to a text file. Powershell add-content example Step 1. Open PowerShell with elevated privileges Step 2. Execute the following command, (change the file path) Add-Content c:\scripts\test.txt "The End" By default, data is

You can read a text file and display its content using get-content cmdlet in PowerShell. Read textfile example Execute the following command on PowerShell with elevated privileges. Get-Content c:\scripts\test.txt This command will display the contents of the file test.txt which

When you have to generate random passwords for users, you can execute the get-random command let on PowerShell to create it. Generate Random Number get-random -maximum 2000 -minimum 100 This command, when executed on PowerShell, creates a number between 1999 (not 2000 and

If you have worked with other programming languages, you have may used functions for code reusability. You can also create functions in PowerShell. PowerShell function example Below is syntax of simple function function hello-world { write-host "hello world" } You can also pass parameters in a

While scripting, you may encouter the problem that you have an expression that uses double-quotes as tags and therefore cannot use any double-quotes inside these tags. You can circumvent this problem by using ASCII codes to add certain keys. This