main

Windows

Find Empty Groups In Active Directory Using PowerShell

basic-powershell-commands-intro-670x335.png?fit=670%2C335

You will be able to find groups from your domain by using the below PowerShell Script, It will scan AD and export its findings to a CSV file.

Please note you will need to change the export directory to one that suits you.

Import-Module activedirectory
Get-ADGroup -Filter * -Properties Members | where {-not $_.members} | select Name | Export-Csv D:\emprtygroups.csv –NoTypeInformation

To find empty groups from any specific OU present in other domain:-

Import-Module activedirectory
Get-ADGroup -Filter * -Properties Members -searchbase “OU fqdn” –server Domain.com:3268  | where {-not $_.members} | select Name | Export-Csv D:\emprtygroups.csv –NoTypeInformation

Windows

Append to DNS Search suffixes set by GPO

Registry.png?fit=512%2C512

An easy way to do this is amending the registry, you can change or remove the DNS Suffixes from here:

HKLM\SOFTWARE\Policies\Microsoft\Windows NT\DNSClient

Open RegEdit and navigate to HKLM\SOFTWARE\Policies\Microsoft\Windows
NT\DNSClient
Edit SearchList by appending a comma plus your four.domain.com to the
entry, then close RegEdit.
Now at an elevated command prompt type “IPCONFIG /REGISTERDNS
You should now see your new entry when you type “IPCONFIG /ALL
This will last until Group Policy is refreshed.
To make the entry disappear after testing, open a cmd prompt and type
GPUPDATE /FORCE

Windows

Adding a Message to Windows 7 logon screen

Registry.png?fit=512%2C512

If you are responsible for managing Windows 7 systems that are open to the public or have multiple user accounts, you may want to add a security message to the logon screen. Fortunately, doing so is easily accomplished by making some minor changes to the existing registry settings and adding a new setting.

In this post, I’ll show you how to delve into Windows 7’s registry to make the appropriate changes.

Editing the registry

It is important to keep in mind that the registry is vital to the operating system and changing it can be dangerous if you inadvertently make a mistake. As such, you should take a few moments to back up your system by creating a Restore Point as well as by creating a system image in the Backup and Restore tool. That way if anything goes awry, you can restore your system and get right back to work.

To launch the Registry Editor, click the Start button, type Regedit in the Start Search box, and press [Enter]. When the UAC dialog box appears, respond appropriately.

Getting started

Once the Registry Editor launches, locate the following key:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System

The warning message

The warning message that you’ll add to the Windows 7’s logon screen is actually made up of two parts: the title and the message text.

To add a title to the warning message, locate and double-click the legalnoticecaption value. When the Edit DWORD dialog box appears, type the title in the Value data text box, as shown in the image below, and click OK. As you can see, for my example I chose to use a Welcome message, but you can essentially type anything that you want for your title. You can use up to 80 characters, including spaces, for the title.

To add the warning message, locate and double-click the legalnoticetext value. When the Edit DWORD dialog box appears, type the warning message in the Value data text box, as shown below, and click OK.

You’re done! You can also set this by Group Policy and Appsense.

Active DirectoryTipsWindows

My Batch File Templates

robocopy-examples.jpg?fit=768%2C411

This script silently installs Sophos but it can be amended to install apps and run various commands.

@ECHO OFF
CLS
ECHO 1.VDI Install
ECHO 2.Physical PC Install
ECHO 3.Mac Client Download
ECHO 4.Reboot This Machine
ECHO 5.Log off This Machine
ECHO.

CHOICE /C 12345 /M "Select your option:"

:: Note - list ERRORLEVELS in decreasing order
IF ERRORLEVEL 5 GOTO Logoff
IF ERRORLEVEL 4 GOTO Reboot
IF ERRORLEVEL 3 GOTO Mac
IF ERRORLEVEL 2 GOTO Physical
IF ERRORLEVEL 1 GOTO VDI

:VDI
ECHO

net use y: "\\ServerPath\SCCM_Content_Source$\Applications\MSI\BPR_Sophos_All"

cd Y:\

VDI.exe -q

GOTO End

:Physical
ECHO

net use y: "\\ServerPath\SCCM_Content_Source$\Applications\MSI\BPR_Sophos_All"

cd Y:\

Desktop.exe -q

GOTO End

:Mac
ECHO

xcopy "\\ServerPath\SCCM_Content_Source$\Applications\MSI\BPR_Sophos_All\Mac.zip" "C:\Users\%username%\Downloads" /y

GOTO End

:Reboot
ECHO

shutdown -t 0 -r -f

GOTO End

:Logoff
ECHO 

shutdown -l -f

GOTO End

:End

 

The below script will copy data from one location to another, just add your UNC path.

Robocopy \\CurrentLocation \\Destination\ /mir /copyall

Windows

How to delete a Windows 7 or 10 Profile

windows-10-4096x3072-4k-5k-wallpaper-microsoft-blue-6991.jpg?fit=768%2C576

How do i delete a Windows user profile??

Method 1

  • Log in as different user (with admin privileges) than you want to delete
  • Open Properties for Computer
  • Advanced system settings (on the left side)
  • Settings for User Profiles (in the middle)
  • Select the profile you want to delete and click the delete button