Tuesday, July 28, 2015
10 PowerShell hot pedaling in your Exchange environment
Microsoft Cluster - Disco reserved
Microsoft Windows [Version 6.1.7601]Copyright (c) 2009 Microsoft Corporation. All rights reserved.C: \ Users \ Admin> diskpartMicrosoft DiskPart version 6.1.7601Copyright (C) 1999-2008 Microsoft Corporation.On computer: VMTESTECLUSTER01DISKPART> list diskDisk ### Status Size Free Dyn Gpt--- ----- --- --- - -Disk 0 Online 100 GB 1024 KBDisk 1 Online 80 GB 1024 KBDisk 2 Online 600 GB 0 BDisk 3 Online 600 GB 0 BDisk 4 Online 600 GB 0 BDISKPART> select disk 1Disk 1 is now the selected disk.DISKPART> detail diskVMware Virtual Disk SCSI Disk DeviceDisk ID: E87C0E42Type: SASStatus: OnlinePath: 0Target: 1LUN ID: 0Location Path: PCIROOT (0) #PCI (1500) #PCI (0000) #SAS (P00T01L00)Current read-only state: NoRead-only: NoBoot Disk: NoPagefile Disk OnHibernation File Disk OnCrashdump Disk OnClustered Disk OnVolume ### Ltr Label Fs Type Size Status Info---- - ---- - ---- --- --- ---Volume 3 D New Volume NTFS Partition 79 GB HealthyDISKPART>Microsoft Windows [Version 6.1.7601]Copyright (c) 2009 Microsoft Corporation. All rights reserved.C: \ Users \ Admin> diskpartMicrosoft DiskPart version 6.1.7601Copyright (C) 1999-2008 Microsoft Corporation.On computer: VMTESTECLUSTER02DISKPART> list diskDisk ### Status Size Free Dyn Gpt--- ----- --- --- - -Disk 0 Online 100 GB 1024 KBDisk 1 Online 80 GB 1024 KBDisk 2 Online 600 GB 0 BDisk 3 Online 600 GB 0 BDisk 4 Online 600 GB 0 BDISKPART> select disk 1Disk 1 is now the selected disk.DISKPART> detail diskVMware Virtual Disk SCSI Disk DeviceDisk ID: E87C0E42Type: SASStatus: OnlinePath: 0Target: 1LUN ID: 0Location Path: PCIROOT (0) #PCI (1500) #PCI (0000) #SAS (P00T01L00)Current read-only state: NoRead-only: NoBoot Disk: NoPagefile Disk OnHibernation File Disk OnCrashdump Disk OnClustered Disk OnVolume ### Ltr Label Fs Type Size Status Info---- - ---- - ---- --- --- ---Volume 3 D NTFS Partition 79 GB HealthyDISKPART>
Clear-ClusterDiskReservation -Disk 1 -node node1 -Force
List Domain Group Members
AllGroups = $ @ ()
$ MyGroups = Get-ADGROUP -filter {GroupCategory -eq "Security"} -SearchBase "dc = DOMAIN, DC = LOCAL" -Properties Name, Member | select Name, Member
foreach ($ Group in $ MyGroups) {
$ GroupInfo.'Group Name '= $ Group.Name
$ GroupInfo.'Group Description '= $ Group.Description
foreach ($ Member in $ Group.Member) {
$ User = Get-Member ADUser $ -Properties Name | select Name
$ GroupInfo.'Member Name '= $ User.Name
$ Groupinfo | select 'Group Name', 'Member Name'
$ AllGroups + = $ groupinfo | Select 'Group Name', 'Member Name'
}
}
Saved Queries
Active Directory Queries!!!!!!
Find Groups that contains the word admin
(objectcategory=person)(description=*admin*)
(groupType:1.2.840.113556.1.4.803:=8)
(objectCategory=group)(!member=*)
Finds all groups defined as a Global Group, a Domain Local Group, or a Universal Group
(groupType:1.2.840.113556.1.4.804:=14)
(objectcategory=person)(samaccountname=*Bob*)
(objectCategory=person)(objectClass=user)(userAccountControl:1.2.840.113556.1.4.803:=65536)
(&(&(objectCategory=person)(objectClass=user))(|(lastLogon=0)(!(lastLogon=*))))
(objectcategory=person)(!scriptPath=*)
(objectcategory=person)(!profilepath=*)
(objectCategory=person)(objectClass=user)(pwdLastSet=0)(!useraccountcontrol:1.2.840.113556.1.4.803:=2)
(objectCategory=person)(objectClass=user)(!useraccountcontrol:1.2.840.113556.1.4.803:=2)
(objectCategory=person)(objectClass=user)(useraccountcontrol:1.2.840.113556.1.4.803:=16)
(groupType:1.2.840.113556.1.4.803:=4)
(objectcategory=person)(mail=*)
(objectcategory=person)(!mail=*)
(|(objectcategory=user)(objectcategory=group)(objectcategory=contact))(|(description=North*)(company=Contractors*))
(objectcategory=user)(|(mobile=712*)(mobile=155*))
(objectCategory=user)(msNPAllowDialin=TRUE)
Note: server name must be changed
(&(&(&(uncName=*Servername*)(objectCategory=printQueue)(printColor=TRUE))))
(&(&(&objectCategory=user)(mDBUseDefaults=FALSE)))
(&(objectCategory=user)(pwdLastSet=0))
Notice the “>=” that means “Greater than or equal to”.
(objectCategory=user)(badPwdCount>=2)
(objectCategory=computer)(!description=*)
(&(objectCategory=person)(objectClass=user)(msExchHideFromAddressLists=TRUE))
(&(&(&(objectCategory=Computer)(operatingSystem=Windows 2000 Professional)(operatingSystemServicePack=Service Pack 4))))
(&(&(&(&(&(&(&(objectCategory=Computer)(operatingSystem=Windows XP Professional)(operatingSystemServicePack=Service Pack 2))))))))
(&(&(&(&(&(&(&(objectCategory=Computer)(operatingSystem=Windows XP Professional)(operatingSystemServicePack=Service Pack 3))))))))
(&(&(&(&(sAMAccountType=805306369)(objectCategory=computer)(operatingSystem=Windows Vista*)(operatingSystemServicePack=Service Pack 1)))))
(sAMAccountType=805306369)
(&(&(&(samAccountType=805306369)(!(primaryGroupId=516)))(objectCategory=computer)(operatingSystem=Windows Server 2003*)))
(&(&(&(samAccountType=805306369)(primaryGroupID=516)(objectCategory=computer)(operatingSystem=Windows Server 2003*))))
(&(&(&(&(samAccountType=805306369)(!(primaryGroupId=516)))(objectCategory=computer)(operatingSystem=Windows Server 2008*))))
Wednesday, February 1, 2012
Wallpaper does not load in Windows 7 via GPO
A known bug in Windows 7 and Windows Server 2008 R2 is for the loading of the wallpaper, when it is configured via GPO.
To solve the problem, we can take the following actions:
- Enter the machine's registry ( http://en.kioskea.net/faq/589-how-to-open-registry )
- Navigate to the following key:
- HKEY_CURRENT_USER \ Control Panel \ Desktop
- Find the REG_SZ value called Wallpaper
- Change the value with the path where the wallpaper is shared.
You can download a fix that will make the change:
If necessary change on multiple workstations, we can effect such change through thePreferences via GPO. As the image below:
If your domain is Windows Server 2003 and either does not support the Preferences feature, you need the distribution via script to make the change key in the registry.
The following example:
Const HKEY_CURRENT_USER = & H80000001
strComputer = "."
Set oReg = GetObject ("winmgmts: {ImpersonationLevel = impersonate}! \ \" & _
strComputer & "\ root \ default: StdRegProv")
strKeyPath = "Control Panel \ Desktop"
strValueName = "Wallpaper"
strValue = "\ \ server \ share \ wallpaper.jpg"
oReg.SetStringValue HKEY_LOCAL_MACHINE, strKeyPath, strValueName, strValue
Libraries and removes the Control Panel icon from the desktop
Personal
This tip can be useful when we set a very restrictive policy in Windows 7 ... .. when we forced the classic theme, the system includes a shortcut on the desktop shell of theLibraries folder and Control Panel. Via GPO until you remove the shortcuts, but it is also remove any link placed on the desktop, even if it is created via logon script ...
The method I found to solve this hurdle, it was deleting the following registry keys:
Remove icon library:
Remove icon in Control Panel:
For those who need to do a VBS for this ... ... follows:
Const HKEY_LOCAL_MACHINE = & H80000002
strComputer = "."
on error resume next
Set oReg = GetObject ("winmgmts: {ImpersonationLevel = impersonate}! \ \" & _
strComputer & "\ root \ default: StdRegProv")
strKeyPath =
strKeyPath =
strKeyPath =
oReg.DeleteKey HKEY_LOCAL_MACHINE, strKeyPath
I hope it's useful!
Monday, March 28, 2011
Script to do a merge between GPO's
Below is the url regarding PowerShell script to perform a merge of two GPO's