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

SSB backup script


@echo off
wbadmin start systemstatebackup -backuptarget:E: -quiet >>E:\Backups\WSB_Logs\SSBackup.log

wbadmin delete systemstatebackup -keepversions:1 -quiet >>E:\Backups\WSB_Logs\SSBackup-del.log

ipconfig /all >E:\Backups\Common\IPconfig_%computername%.txt”

regedit /e “E:\Backups\Common\Reg_%computername%.reg”

sc queryex type= service state= all >”E:\Backups\Common\Service_%computername%.txt”

exit

Server Live status


echo "Host`tState" >> results.csv
$names = Get-Content "hostlist.txt"
foreach ($name in $names) {
    $count = 0
    $count2 = 13490

    if ( Test-Connection -ComputerName $name -Count 1 -ErrorAction SilentlyContinue ) {
        echo "$name`tUp" >> results.csv
    }
    else {
        echo "$name`tDown" >> results.csv
    }

    $count++
    Write-Progress -Activity "Gathering Information" -status "Pinging Hosts..." -percentComplete ($count / $count2 *100)

}

scripts

%d bloggers like this: