Monthly Archives: June 2014

Disable Printer Notifications Server 2008 R2 / Windows 7

To disable printer notifications in Server 2008 R2 / Windows 7

Click Start and select Devices and Printers

Select a printer (it doesn’t matter which one) and select Print Server Properties

Select the Advanced tab, and untick Show informational notifications for network printers.  Click OK.

This will disable the printer notifications for this user on this workstation only.

List files modified between dates in Powershell

I needed to get a list of files modified between 2 dates.  I used the following in Powershell.  Worth noting is regardless of the date format or regional settings, the date format to be used is mm-dd-yy.  The code below will list all files modified between 30 May 2014 and 02 Apri 2014.

get-childitem -recurse | where-object {$_.lastwritetime -gt ’05-30-14′ -AND $_.lastwritetime -LT ’06-02-14′ -AND ! $_.PSIsContainer} | select-object fullname

Shrink a VMware VMDK from command line

I needed to shrink a number of VMWare Workstation 9 virtual disk files (VMDK files) from the command line.

VMWare Workstation 9 doesn’t include the vmware-mount.exe utility, which is needed to mount the drive for preparation.  It is also not included in the Virtual Disk Development Kit 5.5, but can be found in version 5.1.  You can download this from here, although it may possibly move.  Searching the vmware support site for VDDK 5.1 windows may help find it.

Using the powershell script available here can allow you to cycle through a number of VMDK files, additionally perform a contig (available here) to defrag the VMDK files on the physical media.

Basic Get-ADUser powershell commands

I needed to remove the logon script option in AD for all users of an entire domain.  I used the following commands:

Get-ADUser –filter *

This command will list all AD Users

Get-ADUser –filter * | Measure-Object

This command will list the number of users

Get-ADUser –identify ADAdmin –properties *

This command will get all properties of a specific user … in this example, the user is ADAdmin

Get-ADUser –filter * –properties * | Format-Table Name, ScriptPath

This will list the name, and logon script

Get-ADUser –filter * | Set-ADUser –server dc03 –clear scriptpath

This will erase the logon script for all users, running against the server called DC03

 

Properties you can use with Set-ADUser are:

AccountExpirationDate

accountExpires

AccountLockoutTime

AccountNotDelegated

adminCount

AllowReversiblePasswordEncryption

BadLogonCount

badPasswordTime

badPwdCount

CannotChangePassword

CanonicalNameCertificatesCity

CN

codePage

Company

Country

countryCode

Created

createTimeStamp

Deleted

Department

Description

DisplayName

displayNamePrintable

DistinguishedNameDivision

DoesNotRequirePreAuth

dSCorePropagationData

EmailAddress

EmployeeID

EmployeeNumber

Enabled

extensionName

Fax

GivenName

HomeDirectory

HomedirRequired

HomeDrive

homeMDB

homeMTA

HomePage

HomePhone

Initials

instanceType

ipPhone

isDeleted

LastBadPasswordAttempt

LastKnownParent

lastLogon

LastLogonDate

lastLogonTimestamp

legacyExchangeDN

LockedOut

logonCount

LogonWorkstations

mail

mailNickname

Manager

mDBUseDefaults

MemberOfMNSLogonAccount

MobilePhone

Modified

modifyTimeStamp

msDS-User-Account-Control-Computed

msExchALObjectVersion

msExchHomeServerName

msExchMailboxGuid

msExchMailboxSecurityDescriptormsExchMobileMailboxFlags

msExchPoliciesExcluded

msExchRBACPolicyLinkmsExchRecipientDisplayType

msExchRecipientTypeDetails

msExchSafeSendersHash

msExchTextMessagingState

msExchUserAccountControl

msExchUserCulture

msExchVersion

msExchWhenMailboxCreated

msSBSComputerUserAccessOverride

msSBSCreationState

msSBSRoleGuid

msTSExpireDate

msTSLicenseVersion

msTSManagingLS

Name

nTSecurityDescriptorObjectCategoryObjectClass

ObjectGUID

objectSidOffice

OfficePhone

Organization

OtherName

PasswordExpired

PasswordLastSet

PasswordNeverExpires

PasswordNotRequired

POBox

PostalCode

PrimaryGroupprimaryGroupID

ProfilePath

ProtectedFromAccidentalDeletion

protocolSettings

proxyAddressespublicDelegatesBLpwdLastSet

SamAccountName

sAMAccountType

ScriptPath

sDRightsEffective

ServicePrincipalNames

showInAddressBookSIDSIDHistory

SmartcardLogonRequired

sn

State

StreetAddress

Surname

textEncodedORAddressTitle

TrustedForDelegation

TrustedToAuthForDelegation

UseDESKeyOnly

userAccountControl

userCertificate