Home » Archive by category 'Scripts' (Page 2)
Rename all Domain Local Administrator Username Via Script
Use this PowerShell script to rename Local Administrator Account on a list of remote machines. #$erroractionpreference = "SilentlyContinue" $a = New-Object -comobject Excel.Application $a.visible = $True $b = $a.Workbooks.Add() $c = $b.Worksheets.Item(1) $c.Cells.Item(1,1) = "Machine Name" $c.Cells.Item(1,2) = "Account Renamed" $c.Cells.Item(1,3) = "Report Time Stamp" $d = $c.UsedRange $d.Interior.ColorIndex = 19 $d.Font.ColorIndex = 11 $d.Font.Bold = $True $intRow = 2 foreach ($strComputer in Read more
Windows 2008 Identify all AD admins script

PowerShell script to find all Active Directory admins in domain

Get-QADUser -ldapFilter ‘(SamAccountName=*.admin)’|export-csv filename.csv
Windows 2008 How to move terminal service profile to other share
Get-QADUser -SearchRoot 'domainname.com/OuName'|%{$_.TsProfilePath ='\ServerName1profilesshare' + $_.sAMAccountName;$_.CommitChanges();} Change values in RED: Where domainname.com - Fill your domain name Where OUName – Fill desired OU name Where \ServerName1profilesshare – fill your file server name and terminal servers profiles share path Note: I sugest testing it very well before apluing to production enviroment Read more
Find user group membership Powershell script
Use this script to check user group membership in Windows Domain Active Directory $root=([adsi]"").distinguishedName $ou=[adsi]("LDAP://ou=x,ou=y,ou=z,"+$root) # fill  with user  CN “Common Name” $user=$ou.psbase.children.find("cn=tartetCN ") $groups = $user.memberof foreach($group in $groups) { $strGroup = $group.split(',')[0] $strGroup = $strGroup.split('=')[1] $strGroup } Read more