Took longer then expected to work this out, here it is Get-ADUser -filter * -properties * | Where-Object {$_.Enabled -eq $true} |where-object {$_.Passw ordExpired -eq $true} |select name,passwordexpired,mail You can see where there are 2 properties being checked, and I think is should be easy to add a third. wonder if there is a cleaner […]
Category: OneLiner
Cisco Port Security
It is becoming more common that the switch has port security turned on. This means only one MAC can plug into any single port. It is not a big deal to reset it, but for some reason I could not find a direct answer. Here is mine; Reset sticky bit Examples; show port-security sh interface […]
Restart a Service Remotely with Powershell
I have found lots of fancy ways, but here is my one(two) liner (get-service -ComputerName server01 -Name wuauserv).stop (get-service -ComputerName server01 -Name wuauserv).start
Force Delete a File
WARNING!!! THIS WILL FORCE DELETE FILES, USE AT YOUR OWN RISK!!! This one has hounded me many times, and I thought I already did a KB for this, but apparently not, so here goes; First make sure everyone is off, I use the MS file sharing MSC, “Share and Storage Management”. On the […]
Control Panel Command Line CMD.exe
A quick look at commands to get things done faster; Network Adapters ncpa.cpl Firewall firewall.cpl Updates wuaucpl.cpl System Info msinfo.exe Computer Manager Compmgmt.msc Startup and control tabs msconfig My references https://www.maketecheasier.com/20-run-commands-windows/ https://www.lifewire.com/command-line-commands-for-control-panel-applets-2626060 Control Panel Command Line Commands in Windows CMD Commands for Control Panel Applets Applet Command OS Version Accessibility Options control access.cpl XP […]
New Powershell command Get-PerimeterMessageTrace
So I want to put this out there, because I googled the crap out to this hand got zero information. When doing an exchange message trace, it was used to see incoming email. going to have to explore this more, and find out what it really can do. PS C:\Windows\system32> PS C:\Windows\system32> Get-PerimeterMessageTrace […]
Close Telnet Command Window
Use CTRL and ] to close a successful Telnet window. I often use “telnet server ####” to check if the port is open between servers, but can never remember how to close the connection if it works. this is my reminder 🙂
Show all Domain Computers that are Online
Quickie one liner; get-adcomputer -filter * | Where { Test-Connection $_.name -count 1 -quiet } | Select @{Name=”Computername”;Expression={$_.Name}} Reference : https://www.petri.com/test-network-connectivity-powershell-test-connection-cmdlet