# Define input and output file paths
$inputFile = "ip_addresses.txt"
$outputFile = "nslookup_results.csv"
# Read IP addresses from the input file
$ipAddresses = Get-Content $inputFile | Where-Object { $_.Trim() -ne "" }
# Create an array to store results
$results = @()
# Perform nslookup for each IP
foreach ($ip in $ipAddresses) {
try {
$nslookup = nslookup $ip 2>&1
$hostname = ($nslookup | Where-Object { $_ -match "Name:" }) -replace "Name:\s*", ""
if (-not $hostname) {
$hostname = "Lookup failed"
}
} catch {
$hostname = "Lookup failed"
}
$results += [PSCustomObject]@{
"IP Address" = $ip
"Hostname" = $hostname
}
}
# Export results to CSV
$results | Export-Csv -Path $outputFile -NoTypeInformation
Write-Host "Results saved to $outputFile"
Bulk nslookup script
Check Volume License and Digital License
- Open Command Prompt as an administrator.
- Type
slmgr /dlv
and press Enter. - This command will display detailed license information. Look for the License Status and Description fields:
- If it mentions "Volume_MAK" or "Volume_KMS," it is activated using a Volume License.
- If it mentions "Retail" or "OEM," it is not using a Volume License.
Get Motherboard Model and Serial
Get Motherboard Model and Serial
In CMD
wmic baseboard get product,Manufacturer,version,serialnumber
Rearm windows server trail license / expire license
- Open Windows PowerShell
- To check current license status, run slmgr -dlv
- To ream Windows license, run slmgr -rearm
- Restart Windows, run Restart-Computer
Access AD without installing RSAT
Access AD without installing RSAT
Open in Run -
C:\Windows\System32\rundll32.exe dsquery.dll,OpenQueryWindow
VSS Writers Failed (Status and Reason)
Source - http://support.mozy.com/articles/en_US/FAQ/How-do-I-identify-the-cause-of-my-VSS-error
Check status
- Click on Start, then in the Search bar, type cmd.
- When cmd appears at the top of the Start menu, right-click on it and select Run As Administrator.
- Type vssadmin list writers into the command prompt, then press Enter.
Explore Event Logs
VSS errors are typically registered within the Windows' event logs.
Type eventvwr.msc into the open command prompt, then press Enter.
Within the Event Viewer there are two logs in which VSS related errors may be chronicled: The Application Log and the System Log. Under Windows Vista and Windows 7 these logs will be under the category Windows Logs, while in Windows XP these logs will be immediately viewable. VSS errors will appear in the Application Log as entries with a source labeled VSS, and in the System Log they will appear with a source labeled volsnap. For both logs we suggest sorting by source, then look for any items that match either of those source types. Document the Event IDs associated with these errors, as Internet searches for those Event IDs will provide a good start for finding a resolution to your issue.
Take another look at the logs; determine whether there are any repeating errors. There are many other issues that can contribute to VSS errors, and they may be listed under different source headings. Some common service errors that impact VSS deal with the COM+ services, or the MSDTC. Issues with the hard drive or filesystem can also cause VSS issues. In particular, look within the System log for any errors under the source disk, ftdisk or ntfs. If you see any errors or warnings under those source types, you may need to perform a checkdisk.
Server Uptime Script
Server Uptime Script
1. create txt file "Servers.txt"
2. insert server hostname or IP
3. Run script
Powershell code -
$names = Get-Content "C:\Uptime\Servers.txt"
@(
foreach ($name in $names)
{
if ( Test-Connection -ComputerName $name -Count 1 -ErrorAction SilentlyContinue )
{
$wmi = gwmi -class Win32_OperatingSystem -computer $name
$LBTime = $wmi.ConvertToDateTime($wmi.Lastbootuptime)
[TimeSpan]$uptime = New-TimeSpan $LBTime $(get-date)
Write-output "$name Uptime is $($uptime.days) Days $($uptime.hours) Hours $($uptime.minutes) Minutes $($uptime.seconds) Seconds"
}
else {
Write-output "$name is not pinging"
}
}
) | Out-file -FilePath "C:\Uptime\UpUptime_results.txt"
Set Remote Desktop License per User
Setting RD License per User
CMD > gpedit.msc
Browse to
Computer Configuration > Administrative Templates > Windows Components > Remote Desktop Services > Remote Desktop Session Host > Licensing
Double Click Set the Remote Desktop licensing mode
Change it to Enable
Then change Specify the licensing mode for the RD Session Host server to Per User
DONE
Manual add Windows License Servers (Regedit)
Manual License Servers Entry (Regedit)
Open CMD > regedit.
Browse to (Local_Machines\SYSTEM\CurrentControlSet\Services\TermServices\Parameters\LicenseServers)
Add the license server name (Insert Server FQDN) in the (SpecifiedLicenseServers) key.
Extract Windows Install Date and OS Version
Get Install Date and OS Version for a list of Servers provided in a Text file and publish the result in CSV.
Script reads each and every IP/hostname from the inputfile "Serverlist.txt" (Create a Text File "Serverlist.txt" in the same path you save this script), checks if the IP/hostname can be reached.
If it can be reached connects to WMI and collects the Install Date and OS Version (Caption) and we dump it in a CSV file in the same path where you have this script.
1. Create txt file "Serverlist.txt"
2. Insert server ip or hostname in txt file.
3. Run script
PowerShell Code --
<#
Author : Preenesh Nayanasudhan
Script : Get Install Date and OS Version for list of Servers provided in Text file Serverlist.txt
Purpose : Get Install Date and OS Version for list of Servers provided in Text file and publish the result in CSV
Pre-requisite : Create a Text File Serverlist.txt in the same path you save this script
#>
# Input File
$Servers = Get-Content "ServerList.txt"
$report = @()
ForEach ($server in $Servers)
{
#Test if computer is online
if (test-Connection -ComputerName $server -Count 3 -Quiet )
{
$PingResult = 'Server IS Pinging'
# Connect to WMI on remote machine to get the required information
$gwmios = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $server
# Get the Install Date and Convert readable date & time format
$osidate = $gwmios.ConvertToDateTime($gwmios.InstallDate)
$osname = $gwmios.Caption
$tempreport = New-Object PSObject
$tempreport | Add-Member NoteProperty 'Server Name' $server
$tempreport | Add-Member NoteProperty 'Ping Result' $PingResult
$tempreport | Add-Member NoteProperty 'OS Version' $osname
$tempreport | Add-Member NoteProperty 'OS Install Date' $osidate
$report += $tempreport
}
else
{
$PingResult = 'Server NOT Pinging'
$tempreport = New-Object PSObject
$tempreport | Add-Member NoteProperty 'Server Name' $server
$tempreport | Add-Member NoteProperty 'Ping Result' $PingResult
$report += $tempreport
}
}
$report | Export-Csv -NoTypeInformation ('OSInstallDate.csv')
Extract Group Policy Report
Extract Group Policy Report
-----------------------------------------------------------------
Command-
cd desktop <Press enter>
GPRESULT /H GPReport.html <Press enter>
GPReport.html <Press enter>
Find which ports are in use
Find which ports are in use
----------------------------------------------------------------
CMD command
netstat -ano | find "port no."
Compile all csv into one
Compile all csv into one
---------------------------------------------------------------
CMD Command-
cd to Path
copy *.csv All.csv
Find/Extract System Info
System Info TEXT Output
--------------------------------------------------------------
CMD Command -
systeminfo > 01_%Computername%_systeminfo.txt
Find Remote Desktop License grace days left
Find Remote Desktop License grace days left
Command -
wmic /namespace:\\root\CIMV2\TerminalServices PATH Win32_TerminalServiceSetting WHERE (__CLASS !="") CALL GetGracePeriodDays
Extract CMD PowerShell output to a file
Command-
COMMAND_TO_EXTRACT_DATA_FROM | export-csv C:\details.csv
COMMAND_TO_EXTRACT_DATA_FROM >>C:\details.txt