Archive for the ‘Windows’ Category.
February 17, 2023, 1:18 pm
This will remove drivers of working, but disconnected devices. (e.g. USB Drives Printers, old video devices, etc).
FOR /L %G in (1,1,999) do PnPutil.exe -D oem%G.inf
For further cleanup: I recommend Device Cleanup Tool from Uwe Sieber. You can get it from their website.
https://www.uwe-sieber.de/english.html
February 17, 2023, 1:08 pm
This example sends Windows Backup logs
$Yesterday = (Get-Date) - (New-TimeSpan -Day 1)
$logs = Get-WinEvent -logname Microsoft-Windows-Backup | Where-Object {$_.TimeCreated -ge $Yesterday}
$username = "user@domain.com"
$password = "mypassword"
$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
$errorCount = 0
foreach($Event in $logs)
{
$Errorlevel=$Event.LevelDisplayName
if ($Errorlevel -eq "Error")
{
$errorCount++
}
}
$body = "<html>"
$style = "<style>BODY{background-color:white;}.error{color: red;font-weight: bold;}table, th, td{border: 1px solid black;border-collapse: collapse;padding: 5px;}</style>"
$head = "<head>$style</head>"
$body += $head
$body += "<body>"
$body += "<h2>$env:computername Backup Logs</h2>"
if ($errorCount -gt 0)
{
$body += "<h3 class=""error"">$errorCount Errors</h3>"
}
$body += "<table><tr><td>Time</td><td>Error Level</td><td>EventId</td><td>Message</td></tr>"
# Get the event Log Details
foreach($Event in $logs)
{
$Time=$Event.TimeCreated
$Errorlevel=$Event.LevelDisplayName
$EventId=$Event.Id
$Message=$Event.Message
$TableLine = "<tr><td>$Time</td><td>$Errorlevel</td><td>$EventId</td><td>$Message</td></tr>"
if($Errorlevel -eq "Error")
{
$TableLine = "<tr class=""error""><td>$Time</td><td>$Errorlevel</td><td>$EventId</td><td>$Message</td></tr>"
}
$body += $TableLine
}
$body += "</table>"
$body += "</body>"
$body += "</html>"
#echo $body
$subject = "$env:computername Backup Logs"
if ($errorCount -gt 0)
{
$subject += " - $errorCount Errors"
}
Send-MailMessage -BodyAsHTML $body `
-From me@domain.com `
-SmtpServer mail.server.com`
-Subject $subject `
-To "me@domain.com" `
-UseSsl -Credential $cred
February 17, 2023, 1:02 pm
This script can be used to send windows event logs on period basis to specific e-mail. Below example sending last 24 hours of events in the Windows Essential Licensing section.
$Yesterday = (Get-Date) - (New-TimeSpan -Day 1)
$logs = Get-WinEvent -LogName "Microsoft-Windows-Server Infrastructure Licensing/Operational" | Where-Object {$_.TimeCreated -ge $Yesterday} | Format-List | Out-String
$username = "user@domain.com"
$password = "mypassword"
$secstr = New-Object -TypeName System.Security.SecureString
$password.ToCharArray() | ForEach-Object {$secstr.AppendChar($_)}
$cred = new-object -typename System.Management.Automation.PSCredential -argumentlist $username, $secstr
#Send-MailMessage [-Attachments ] [-Bcc ] [[-Body] ] [-BodyAsHtml]
# [-Encoding ] [-Cc ] [-DeliveryNotificationOption ]
# -From [[-SmtpServer] ] [-Priority ] [-Subject] [-To]
# [-Credential ] [-UseSsl] [-Port ] []
Send-MailMessage -Body $logs `
-From me@domain.com `
-SmtpServer mail.server.com `
-Subject "Licensing Logs" `
-To "user@domain.com" `
-UseSsl -Credential $cred
February 17, 2023, 12:58 pm
Reboot will be required after adding this to registry
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Defender" /f /v DisableAntiSpyware /t REG_DWORD /d 0x00000001
July 2, 2013, 5:32 pm
We had an issue here at the office where if we received a plain text e-mail (mostly from outlook users), then reply as HTML it would place the the whole reply in the <pre> tag. This would cause the whole quoted message not to wrap and making it a pain to read and impossible to print.
Here is solution that seems to work so far
November 8, 2012, 11:13 am
July 20, 2012, 2:58 pm
At work we had an issue where two Windows 7 Home Pre clients would not show newly created files on mapped network drive. Normal refresh wouldn’t cut it, but unmount and remount or a pc reboot would. After little of googling I found I wasn’t alone.
http://social.technet.microsoft.com/Forums/en/w7itprogeneral/thread/947489ae-dc86-45f0-ad5e-463a62e1d59f
Even though this topic’s setup was a windows server and here at my office we use Samba 3.6.3 with SMB2.0 enabled. But the symptoms were very similar. The finger was pointed at the new caching abilities in the SMB2.0 client. The solution was to disable DirectoryCacheLifetime on the client via a registry entry. Here is Microsoft link for description of DirectoryCacheLifetime http://technet.microsoft.com/en-us/library/ff686200(WS.10).aspx
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters]
“DirectoryCacheLifetime”=dword:00000000
In my experience it seems that only Windows 7 Home Pre clients are effected, our Windows 7 Pro clients have no issues. I applied the registry entry to the Windows 7 Pro machines as well with no side effects.
April 27, 2012, 1:49 pm
Little windows batch script I made to convert 1 flac at a time to AAC (m4a)
C:\ffmpeg.exe -i %1 -c aac -ab 256k -strict experimental "%~d1%~p1%~n1.m4a"
grab ffmpeg.exe from http://ffmpeg.org/download.html
August 5, 2011, 2:13 pm
Some applications while processing a request can ‘freeze’ or lag the UI of the OS. But most are single threaded applications and I sit on a powerful multi-core desktop. My example Mail Merge in Microsoft Word. My work around so I can keep working in other applications on my desktop is to make multiple user accounts. So when I want to run a MS Word mail merge I first switch to ‘Jason2’ account and start the long mail merge process, and switch back to my main account to continue working with no UI Lag from the OS.
Silly Windows.
July 21, 2011, 10:45 am
Hello World! This will be the most boring post ever. For who ever reads this post, my goal with the website is to store notes, steps on how I solved problems, tips, and other computer related things. There has been many times blogs have shown me the way to fix complicated computer issues. So now on I will try to post every computer issues I have with a solution so maybe I can help someone with the same issue.