Messing about with IT

Tag: PowerShell

PowerShell script to check the status and start the Microsoft SMTP virtual server

For a time, I had a server with an issue where the IIS SMTP virtual server stopped due to an error. My usual automatic checks for stopped Windows services didn’t pick this up because the Windows service continued to run, even though the SMTP virtual server had stopped.

This caused some internal emails to be delayed. It was easy enough to start the virtual server again, but better to put a script in place to check the status and start the SMTP virtual server if necessary.

Continue reading

Set the computer description remotely using PowerShell

Here’s a quick PowerShell script which allows you to set the computer description remotely.

You’ll need to run this in a PowerShell window with administrative rights for the remote PC.

$RemotePC = Read-Host -Prompt 'Input the remote computer name e.g. PC0123'
$RemoteDescription = Read-Host -Prompt 'Input the new description for the remote computer'

$PC = Get-WmiObject -class Win32_OperatingSystem -computername $RemotePC
$PC.Description = $RemoteDescription

$PC.Put()

© 2024 Tech Explorer

Theme by Anders NorénUp ↑