Wednesday 23 April 2014

Windows: Single Command To Release & Renew IP Address

To release and renew an IP address in a single command:

ipconfig /release && ipconfig /renew

Saturday 12 April 2014

HP Universal Print Driver: Printer Offline

Network printer shows as offline when using HP Universal Print Driver.

Open Devices and Printers.
Open the properties page for the printer.
Select the Ports tab.
Select Configure Port...
Untick SNMP Status Enabled.

Monday 7 April 2014

DFS Replication: Corrupt Database - Event ID 467

DFS not replicating with the following event logged on the affected server:

DFSRs (1624) \\.\F:\System Volume Information\DFSR\database_123A_B9CD_8EF9_4623\dfsr.db: Database \\.\F:\System Volume Information\DFSR\database_123A_B9CD_8EF9_4623\dfsr.db: Index IDContentSetIdGvsnIndex of table IDTable is corrupted (0).

To resolve:

Backup replicated DFS directory using Robocopy:

robocopy F:\ G:\ /B /E /COPYALL /DCOPY:T /R:6 /XD "$RECYCLE.BIN" "System Volume Information" /LOG:robo.log /TEE

Run secondary backup if necessary using /PURGE to mirror any subsequent changes:

robocopy F:\ G:\ /B /E /COPYALL /DCOPY:T /R:6 /XD "$RECYCLE.BIN" "System Volume Information" /LOG:robo.log /TEE /PURGE

Open command prompt, change to affected drive and run dir to obtain file list for future reference:

dir /B /S > c:\filelist.txt

Delete replication groups and members and stop DFSR service on server with corrupt database:

net stop DFSR

Launch elevated command prompt and grant Domains Admins right to the System Volume Information folder on affected DFSR drive:

icacls "F:\System Volume Information" /Grant "Domain Admins":F

Delete corrupt DFSR directory within System Volume Information:
rd "F:\System Volume Information\DFSR" /S /Q

Remove Domain Admins from System Volume Information:

icacls "F:\System Volume Information" /remove:g "Domain Admins"

Restart DFSR service and recreate replication group.

Monitor the status of DFS replication:

wmic /namespace:\\root\microsoftdfs path dfsrreplicatedfolderinfo get replicationgroupname,replicatedfoldername,state

dfsrdiag replicationstate

Thursday 3 April 2014

Windows: Create Fixed Size File

Use the following command to create an empty file of a fixed size:

fsutil file createnew <filename> <size in bytes>

For example, to create a 1MB file:

fsutil file createnew c:\file.txt 1048576

Active Directory: Find When User Account Password Expires

To view the details of a user account including password expiry date:

net user username /domain

The request will be processed at a domain controller for domain domain.local.

User name                    username
Full Name                    User Name
User's comment
Country code                 000 (System Default)
Account active               Yes
Account expires              Never

Password last set            02/04/2014 18:00:00
Password expires             28/05/2014 18:00:00
Password changeable          03/04/2014 18:00:00
Password required            Yes
User may change password     Yes

Workstations allowed         All
Logon script
User profile                
Home directory              
Last logon                   01/04/2014 09:00:00

Logon hours allowed          All

Local Group Memberships
Global Group memberships