PowerShell: Create AD computer objects as per the given details in the list
Sometimes admin need to pre-create AD computer object in correct OU as per the user and update the user’s information it belongs to in the Managed By field. Below script will receive input as list of computers and their corresponding users to whom the machine will be assigned. Create two files in C:\Temp directory: ComputerList.txt […]
Windows Firewall – Disable / Enable
# Check Firewall StatusGet-NetFirewallProfile | Format-Table Name, Enabled # Disable FirewallSet-NetFirewallProfile -Profile Domain, Public, Private -Enabled False # Check Firewall StatusGet-NetFirewallProfile | Format-Table Name, Enabled # Enable FirewallSet-NetFirewallProfile -Profile Domain, Public, Private -Enabled True
PowerShell: Detect and Fix – Hybrid Join, CCM CoManagement and Intune Service
# Removing any previous variables and their values (if any) Remove-Variable -Name “*Check*” -Force -ErrorAction SilentlyContinue # Defining variables and system status $HybridCheck = C:\Windows\System32\dsregcmd.exe -ArgumentList “/status” -NoNewWindow | Select-String -Pattern KeySignTest | Select-Object -ExpandProperty Line -ErrorAction SilentlyContinue $CoManagementCheck = Get-ItemProperty -Path HKLM:\SOFTWARE\Microsoft\CCM -Name “CoManagementFlags” | Select-Object -ExpandProperty CoManagementFlags -ErrorAction SilentlyContinue $IntuneServicecheck = Get-Service -DisplayName […]
Get values from two files and execute in PowerShell script
Administrators may need to execute a PowerShell script based on values inside two different files. This task can be achieved by using arrays in PowerShell. Consider a scenario in which you have a Computer Name and their respective MAC addresses in two different files. Then you can create two variables to store the computer names […]
MS Defender – Fix Sensor Onboarding Issue
Sometimes you will notice that few machines will fail to complete the Defender Onboarding process. This issue could occur due to multiple reasons, one of the common reasons is machine unexpectedly restarted during the onboarding process. There is no article or any documentation from Microsoft explaining this behavior however, on further troubleshooting using process monitor, […]
Power Automate – Send Birthday Email
If you are just starting with power automate and trying out some simple stuffs to find your way around. One of the most popular automation is to trigger an automated email greeting Birthday wishes to your colleagues. Not everyone would have access to system to fetch the birthdates of colleagues. If you have a small […]
Query SCCM Baselines using WMI
To get list of all baselines assigned to the computer: Open PowerShell with elevated privilege and run below command: Get-WmiObject -Namespace root\ccm\dcm -class SMS_DesiredConfiguration | Select-Object -Property DisplayName | Sort-Object -Property DisplayName To Trigger evaluation of one specific baseline: e.g., you want to trigger a baseline that evaluates Hybrid Azure […]
Hybrid Azure Join script
# You can use this as a RUN Script in SCCM or package it and make it available in software center # Performs DSREGCMD /join (requires elevation) and triggers Intune-Device-Sync # Status of each step is logged as well. $LogFilePathJoin = “C:\Windows\Temp\Logs\CA_Hybrid_Join.log” $LogFilePathStatus = “C:\Windows\Temp\Logs\CA_Hybrid_status.log” Start-Process -FilePath “C:\Windows\system32\dsregcmd.exe” -ArgumentList (“/join /debug”) -NoNewWindow -PassThru -RedirectStandardOutput “$LogFilePathJoin” […]
Find installed O365 apps version
To find version on single machine: Get-ItemPropertyValue -Path HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration -Name “VersionToReport” To find version on multiple machines: Invoke-Command -ScriptBlock {Get-ItemPropertyValue -Path HKLM:\SOFTWARE\Microsoft\Office\ClickToRun\Configuration -Name “VersionToReport”} -ComputerName PC1,PC2,PC3
Display Program Install Date
Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Select-Object DisplayName, DisplayVersion, Publisher, InstallDate | Format-Table –AutoSize