# Windows Server Latency Diagnostic Script # Run in PowerShell with Administrator privileges Write-Host "=== CPU & Memory Usage ===" Get-Counter '\Processor(_Total)\% Processor Time' Get-Counter '\Memory\Available MBytes' Write-Host "`n=== Top Processes by CPU ===" Get-Process | Sort-Object CPU -Descending | Select-Object -First 10 Name, CPU Write-Host "`n=== Disk I/O Performance ===" Get-Counter '\PhysicalDisk(_Total)\Avg. Disk sec/Read' Get-Counter '\PhysicalDisk(_Total)\Avg. Disk sec/Write' Get-Counter '\PhysicalDisk(_Total)\Disk Transfers/sec' Write-Host "`n=== Network Latency (Ping Test) ===" Test-Connection -ComputerName google.com -Count 4 Write-Host "`n=== TCP Settings ===" Get-NetTCPSetting | Format-Table SettingName, CongestionProvider, AutoTuningLevelLocal Write-Host "`n=== Event Viewer Errors (Last 50) ===" Get-EventLog -LogName System -EntryType Error -Newest 50 | Forma...
Posts
- Get link
- X
- Other Apps
$From = "pugazhjan30@gmail.com" $To = "pugazhjan30@gmail.com" $Subject = "Email subject goes here" $Body = "Email body goes here" # The password is an app-specific password if you have 2-factor-auth enabled $Password = "" | ConvertTo-SecureString -AsPlainText -Force $Credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $From, $Password Send-MailMessage -From $From -To $To -Subject $Subject -Body $Body -SmtpServer "smtp.gmail.com" -port 587 -UseSsl -Credential $Credential App passwords
System state backup by using Windows Server Backup fails with error: System writer is not found in the backup
- Get link
- X
- Other Apps
Event ID 517 Takeown /f %windir%\winsxs\temp\PendingRenames /a icacls %windir%\winsxs\temp\PendingRenames /grant "NT AUTHORITY\SYSTEM:(RX)" icacls %windir%\winsxs\temp\PendingRenames /grant "NT Service\trustedinstaller:(F)" icacls %windir%\winsxs\temp\PendingRenames /grant "BUILTIN\Users:(RX)" Takeown /f %windir%\winsxs\filemaps\* /a icacls %windir%\winsxs\filemaps\*.* /grant "NT AUTHORITY\SYSTEM:(RX)" icacls %windir%\winsxs\filemaps\*.* /grant "NT Service\trustedinstaller:(F)" icacls %windir%\winsxs\filemaps\*.* /grant "BUILTIN\Users:(RX)" net stop cryptsvc net start cryptsvc https://learn.microsoft.com/en-us/troubleshoot/windows-server/backup-and-storage/system-writer-not-found-in-backup
slmgr.vbs OS key activation
- Get link
- X
- Other Apps
To view current license status cscript /Nologo "C:\Windows\System32\slmgr.vbs" /dli Manually activate using key cscript c:\windows\system32\slmgr.vbs /ipk P*************A cscript c:\windows\system32\slmgr.vbs /ato To set to Azure KMS slmgr.vbs /skms azkms.core.windows.net slmgr.vbs /ato https://learn.microsoft.com/en-us/troubleshoot/windows-server/licensing-and-activation/error-0xc004e015-sl-e-eul-consumption-failed-activate-windows https://learn.microsoft.com/en-us/windows-server/get-started/kms-client-activation-keys?tabs=server2019%2Cwindows1110ltsc%2Cversion1803%2Cwindows81#generic-volume-license-keys
Windows sites - update
- Get link
- X
- Other Apps
https://www.catalog.update.microsoft.com http://windowsupdate.microsoft.com http://*.windowsupdate.microsoft.com https://*.windowsupdate.microsoft.com http://*.update.microsoft.com https://*.update.microsoft.com http://*.windowsupdate.com http://download.windowsupdate.com https://download.microsoft.com http://*.download.windowsupdate.com http://wustat.windows.com http://ntservicepack.microsoft.com http://go.microsoft.com http://dl.delivery.mp.microsoft.com https://dl.delivery.mp.microsoft.com http://*.delivery.mp.microsoft.com https://*.delivery.mp.microsoft.com
Time service - time sync issue
- Get link
- X
- Other Apps
Time service - time sync issue w32tm /monitor w32tm /unregister net stop w32time w32tm /register net start w32time w32tm /config /manualpeerlist:<ntp ip address> /syncfromflags:manual /reliable:yes /update net stop w32time net start w32time then check w32tm /query /source w32tm /query /configuration VMwareToolboxCmd.exe timesync status
AD ports
- Get link
- X
- Other Apps
Port Protocol Service 53 TCP/UDP DNS 88 TCP/UDP Kerberos authentication 123 UDP W32Time 135 TCP RPC Endpoint Mapper 137/138 * UDP NetBIOS 139 * TCP NetBIOS 389 TCP/UDP LDAP 445 TCP SMB 464 TCP/UDP Kerberos password change 636 TCP LDAP SSL 3268/3269 TCP LDAP Global Catalog / LDAP GC SSL 49152-65535 TCP RPC Ephemeral Ports
DNS Audit about newly created records
- Get link
- X
- Other Apps
DNS Audit about newly created records $ComputerName = 'pugazh' $Zones = Get-DnsServerZone -ComputerName $ComputerName | Where-Object { $_.IsDsintegrated } #get all zones I care about $DNSRecords = $Zones | Get-DnsServerResourceRecord -ComputerName $ComputerName #get every DNS record $RecordAndOwner = $DNSRecords | ForEach-Object { [pscustomobject]@{ Record = $_ Owner = (Get-Acl $('AD:\' + $_.DistinguishedName)).Owner } } $RecordAndOwner #List all the owners... wait, that is too much stuff and too hard to read #List everyone that has created a DNS record and how many records they have created (only checks owner, but owner is the creator by default) $RecordAndOwner | Group-Object owner | Select-Object count, name | Sort-Object name #Omit records created by se...
Powershell: Remove multiple users from a single AD group
- Get link
- X
- Other Apps
Remove multiple users from a single AD group https://www.powershellbros.com/remove-user-from-specifc-ad-groups-using-powershell/ Start-Transcript -Path C:\Temp\Remove-ADUsers.log -Append #Taking AD group member detail and will send them by Mail. #Getting AD group member detail and save in CSV format. (Get-ADGroup " AD-Group-Name " -properties members).members | Get-ADUser -properties displayName | Select-Object displayName,SamAccountName,emailaddress | export-CSV c:\users\administrator\ AD-Group-Name (or File-Name) .csv #Import the user list $Users = Import-Csv " C:\Temp\ Users.csv " #Update the AD group name which is need to be removed for listed users. $Group = “ AD-Group-Name ” $Report = @() foreach ($User in $Users) { $UPN = $User.UserPrincipalName $ADUser = Get-ADUser -Filter "UserPrincipalName -eq '$UPN'" | Select-Object SamAccountName $ExistingGroups = Get-ADPrincipalGroupMembership $ADUser.SamAccountName | Select-Obje...
DNS IP change
- Get link
- X
- Other Apps
$ComputerName = get-content " $env:USERPROFILE \desktop\servers.txt" $report = @() foreach ( $Computer in $ComputerName ) { $Networks = Get-WmiObject -Class "win32_networkadapterconfiguration" -ComputerName $Computer } foreach ( $Network in $Networks ) { $IPAddress = $Network . IpAddress [ 0 ] $SubnetMask = $Network . IPSubnet [ 0 ] $DefaultGateway = $Network . DefaultIPGateway $DNSServers = $Network . DNSServerSearchOrder $MACAddress = $Network . MACAddress $OutputObj = New-Object -Type PSObject $OutputObj | Add-Member -MemberType NoteProperty -Name ComputerName -Value $Computer . ToUpper(...
Homepath profile path set permission
- Get link
- X
- Other Apps
$csv = Import-Csv -Path "$env:userprofile\desktop\KDrivePath.csv" ForEach ($item In $csv) { $acl = Get-Acl $item.Path $AddPerm = New-Object System.Security.AccessControl.FileSystemAccessRule($item.GroupName,"FullControl","ContainerInherit, ObjectInherit", "None","Allow") $acl.SetAccessRule($AddPerm) $acl | Set-Acl $item.Path Write-Host -ForegroundColor Green "Group $($item.GroupName) created!" }
DHCP - Report with DHCP scope option
- Get link
- X
- Other Apps
$ListofScopesandTheirOptions = $Null $PrimaryDHCPServer = "s217124rgvw210" $Scopes = Get-DhcpServerv4Scope -ComputerName $PrimaryDHCPServer #For all scopes in the primary server, get the scope options and add them to $LIstofSCopesandTheirOptions foreach ($Scope in $Scopes) { $LIstofSCopesandTheirOptions += Get-DHCPServerv4OptionValue -ComputerName $PrimaryDHCPServer -ScopeID $Scope.ScopeId |select @{label=”DHCPServer”; Expression= {$PrimaryDHCPServer}},@{label=”ScopeID”; Expression= {$Scope.ScopeId}},@{label=”ScopeName”; Expression= {$Scope.Name}},* }