Posts

Showing posts from April, 2017

Powershell - Add Users / Computers to AD Group

The below script can be used to add multiple user or computer to an AD group. The list of users / computers to be provided in the text file. Usage: See below example. To see full help Type script name and press enter. You have to provide computer name or user name (SAM Account) in text file. Add computer to AD Group     .\AddObjectsToADGroup.ps1 -FileName Computers.txt -ADGroupName "TestGroup" -ObjectType Computer .Add user to AD group     .\AddObjectsToADGroup.ps1 -FileName Computers.txt -ADGroupName "TestGroup" -ObjectType User Github Repostiorty Raw File #Script #Version: 1.0 #Author: Equebal Ahmad <# .SYNOPSIS     Add the computers / users account to an AD Group .DESCRIPTION     Add the computers / users account to an AD Group     The script can add user and computer in an AD group. You need to pass this with ObjectType parameter. .EXAMPLE     .\AddObjectsToADGrou...

Configuration Manager - Maintenance Window for member of specific collection

The below SQL query will provide the details of Maintenance Window with collection name for all members in provided collection. select fcm.Name as 'Server Name',sw.CollectionID,col.Name as 'Collection Name',sw.Name as 'MW Name',sw.Description,sw.StartTime,sw.Duration,sw.IsEnabled from v_ServiceWindow SW inner join v_FullCollectionMembership fcm on fcm.CollectionID = sw.CollectionID inner join v_Collection col on col.CollectionID = sw.CollectionID where fcm.name in (select name from v_FullCollectionMembership where collectionID = ' CollectionID ')

Powershell - Get system uptime

$Computer = Read-Host   "Input Computer Name " $LastBoot = (Get-WmiObject -Class Win32_OperatingSystem -ComputerName $Computer ).LastBootUpTime $uptime = (Get-Date) - [System.Management.ManagementDateTimeconverter]::ToDateTime($LastBoot) Write-Host  "$Computer uptime is:"     [$uptime]   [dd:hh:mm:ss.ms]