PowerShell: Add users from CSV to AD group
Below example code which you can use to add users from a local CSV file (with their UPN) to a active directory group.
I.T. minded
Below example code which you can use to add users from a local CSV file (with their UPN) to a active directory group.
Below is a high-level approach on how you might achieve this using PowerShell and the Azure CLI:
Use the powershell command below to get the list of processes on a remote Windows computer, sorted by CPU usage.
With the powershell script below, you can check TLS settings on Windows Server .
It’s possible that you want to change routes on a system which point to a certain gateway, and replace them with a new gateway. The only thing this silly powershell is doing, is getting the list of routes, filter out…
In Powershell, you can also use a grep like you can do on Linux.In order to search for a string in a file, you can use the following command: If you want to have the output without filename, line number:…
List running processes and sort by cpu Get-Process | Sort-Object -Property cpu -Descending
Within Powershell you can also see when a LOCAL user was last logged in. This can be done with the following one-liner: $([ADSI]”WinNT://$env:COMPUTERNAME”).Children | where {$_.SchemaClassName -eq ‘user’} | ft name,lastlogin example output: name lastlogin —- ——— {localadmin} {28/09/2016 08:57:19}…
With Powershell you can also find files which are larger than a certain size. This can be accomplished with the command below. In this example we are looking for files larger than 100MB, on the C drive. Get-ChildItem c:\ -Recurse…
If you want to test a firewall rule, while the application isn’t ready yet, you can start that port on the Windows server using Powershell. This way you can test the firewall functionality. Those actions can be done with the…
Performance issues. Everybody had them once, and more 🙂 If you are using Windows 2012+ and Powershell, you can use the Get-Counter command in order to provide you more information regarding the TCP connections. In the example below, we are…
If you want to configure the DNS suffix search list on Windows 2012+, you can use the set-DnsclientGlobalSetting command, as shown in the example below. This will set the DNS search list to “domain.local”: set-DnsClientGlobalSetting -SuffixSearchList @(“domain.local”)
Sometimes there are some applications which take the ‘first network card’ in order to send/receive traffic. If you have multiple network cards, this can be problematic of course. In case you want to resolve that, you can change the order…
Hello, In addition to “PowerShell: Run command at certain date/time”, we got the request to include a start time also. In the script below, we are doing such thing. (write-host commands are in Dutch tho). In case the user specifies a valid…
Sometimes it can be handy to automatically stop a process at a certain time. I did this using the following powershell script. The script will first ask at what time it needs to be stopped. You can specify seconds if…