Find OS versions


Get-Content F:\computers.txt | ForEach-Object{Get-ADComputer $_ -Properties Name,LastLogonDate,OperatingSystem | Select-Object Name,LastLogonDate,OperatingSystem} | Export-Csv report_computers.csv

 

Windows server 2008 above system state backup automation


@echo off
wbadmin start systemstatebackup -backuptarget:D: -quiet >>D:\Backups\WSB_Logs\Backup.log
wbadmin delete systemstatebackup -keepversions:1 -quiet >>D:\Backups\WSB_Logs\Backup-del.log
ipconfig /all >D:\IPDetails_Backups\Common\IPconfig_%computername%.txt”
regedit /e “D:\Re_Backups\Common\Reg_%computername%.reg”
sc queryex type= service state= all >”D:\Services_Backups\Common\Service_%computername%.txt”
exit

Note:

Save as SSB.cmd

Schedule task. Don’t forget to select run with high privileges

Powershell: Automating AD Bulk Users Movement between OUs

Scripts


—————————–IP to name PC name resolve Bulk machines————————–

Get-Content “C:\Disk Report\Serverlist.txt” | ForEach-Object{
$hostname = ([System.Net.Dns]::GetHostByAddress($_)).Hostname
if($? -eq $True) {
$_ +”: “+ $hostname >> “C:\machinenames.txt”
}
else {
$_ +”: Cannot resolve hostname” >> “C:\machinenames.txt”
}}

——————————————————-Done————————————————————————–

Get the Computer Name, IP Address and others with this batch file

@echo off
echo Checking your system infor, Please wating…
systeminfo | findstr /c:”Host Name”
systeminfo | findstr /c:”Domain”
systeminfo | findstr /c:”OS Name”
systeminfo | findstr /c:”OS Version”
systeminfo | findstr /c:”System Manufacturer”
systeminfo | findstr /c:”System Model”
systeminfo | findstr /c:”System type”
systeminfo | findstr /c:”Total Physical Memory”
ipconfig | findstr IPv4

echo.

echo Hard Drive Space:
wmic diskdrive get size

echo.
echo.

echo Service Tag:
wmic bios get serialnumber

echo.
echo.
echo CPU:
wmic cpu get name

echo Completed! Thank you!

pause


Display Current User, Host Name and IP Address


@echo off
echo\
echo I am logged on as %UserName%.
echo My computer's name is %ComputerName%.
echo My IP settings are
ipconfig | find "." | find /i /v "suffix"
echo\
echo Press the Space bar to close this window.
pause > nul

GP


Invoke-Command {
gpupdate /force
}

Find empty groups in Active Directory using PowerShell script


You can find the empty groups from your domain using below powershell command.

Import-Module activedirectory
Get-ADGroup -Filter * -Properties Members | where {-not $_.members} | select Name | Export-Csv D:\emprtygroups.csv –NoTypeInformation

To find empty groups from any specific OU present in other domain:-

Import-Module activedirectory
Get-ADGroup -Filter * -Properties Members -searchbase “OU fqdn” –server Domain.com:3268  | where {-not $_.members} | select Name | Export-Csv D:\emprtygroups.csv –NoTypeInformation

IPv6 disable PS script


Set-ExecutionPolicy -ExecutionPolicy Bypass

Get-NetAdapter | Set-NetAdapterBinding -ComponentID ms_tcpip6 -Enabled $false

%d bloggers like this: