powershell

PowerShell Office365 Simple Security Report

20th September 2022

Install-Module AzureADPreview(Only need to do this once) Connect-AzureADThis will ask for creds with permission to admin your Office365 Get-AzureADAuditSignInLogs -Filter “location/countryOrRegion ne ‘CA’ and location/countryOrRegion ne ” and Status/ErrorCode eq…

📌
0💬 read more

Windows Updates via Powershell

4th June 2022

From Local PC: PowershellInstall-Module PSWindowsUpdateset-executionpolicy remotesignedGet-WindowsUpdate -verbose -AcceptAll -Install Remote PC: PS C:\share> $RemoteServer = “wtf005.wtf.local”PS C:\share> Get-WindowsUpdate -verbose -computer $RemoteServer -AcceptAll -InstallVERBOSE: wtf005.wtf.local (7/14/2022 3:26:58 PM): Connecting to Microsoft…

📌
0💬 read more

Useful PowerShell commands

24th June 2020

List AD users that haven’t logged on in 30 daysImport-Module activedirectoryGet-ADUser -Filter {Enabled -eq $TRUE} -SearchBase $OU -Properties Name,SamAccountName,LastLogonDate | Where {($_.LastLogonDate -lt (Get-Date).AddDays(-30)) -and ($_.LastLogonDate -ne $NULL)} | Sort…

📌
0💬 read more