Friday, January 13, 2017

Piped logging program to rotate Apache logs


This creates the files logs\access_yyyy_mm_dd.log where yyyy is the year, mm is the month, and dd is the day of the month. Logging will switch to a new file every day at midnight, local time for xampp in windows.

Solution:
Changed in xampp\apache\conf\httpd.conf

CustomLog "|bin/rotatelogs.exe -l logs/access_%Y_%m_%d.log 86400" common

option used
-l Causes the use of local time rather than GMT as the base for the interval or for strftime(3) formatting with size-based rotation.
%Y 4-digit year
%m 2-digit month
%d 2-digit day of month
rotationtime The time between log file rotations in seconds.


Reference: http://httpd.apache.org/docs/current/programs/rotatelogs.html







Tuesday, November 22, 2016

Synchronize Windows Server 2008 (R2) PDC time with external NTP server

PDC need to synchronize to reliable external time source and other member need to synchronize to this PDC only.

For PDC
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\AnnounceFlags
DWORD Value, type 5

net stop w32time

w32tm /config /syncfromflags:manual /manualpeerlist:"0.pool.ntp.org,0x1 1.pool.ntp.org,0x1 2.pool.ntp.org,0x1”  /reliable:yes /update

w32tm /resync /rediscover

net start w32time

you can check result from:
Event Viewer
- w32tm /stripchart /computer:id.pool.ntp.org /samples:2 /dataonly
  error: 0x800705B4 means timeout or no access to NTP server
w32tm /query /configuration    and look for NTP server value
- HKLM\System\CurrentControlSet\services\W32Time\Parameters NTPServer value

to reset back to default
net stop w32time
w32tm /unregister
w32tm /register
net start w32time


For other DC
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\W32Time\Config\AnnounceFlags

DWORD Value, type A

net stop w32time

w32tm /config /syncfromflags:DOMHIER /update

w32tm /resync /nowait /rediscover

net start w32time




Tuesday, November 1, 2016

Migrating 2003 AD to 2008 R2 (Part 1)

Force promote DC2 as PDC when DC1 who hold FSMO roles no longer exist

Symptoms:
Want to migrate DC from Windows 2003 server to Windows 2008 R2 server. But DC1 who hold PDC no longer exist.

Solution:
Force moving FSMO to DC2 using ntsdutil

  1. ntdsutil
  2. roles
  3. connections
  4. connect to server DC2
  5. quit
  6. seize PDC
  7. seize schema master
  8. seize RID master
  9. seize infrastructure master
  10. seize domain naming master
  11. quit
Remove DC1 from AD using ntdsutil
  1. ntdsutil
  2. metadata cleanup
  3. connections
  4. connect to server DC2
  5. quit
  6. select operation target
  7. list domains
  8. select domain 0
  9. list sites
  10. select site 0
  11. list servers in site
  12. select server DC1
  13. quit
  14. remove selected server
  15. Confirm by click YES in message box (make sure removing DC1 server)
Remove any trails of DC1 record in:
  1. Active Directory Sites and Services
    1. remove from server object
  2. Active Directory Users and Computers
    1. remove from server object
  3. DNS
    1. remove all DC1 ip records
    2. remove from replicate


Tuesday, May 17, 2016

Configuring IBM IMM IP from Windows Command Prompt

To change IP of IMM using Advanced Settings Utility from IBM


asu64.exe set imm.hostipaddress1 192.168.xxx.xxx

asu64.exe set imm.hostipsubnet1 255.255.255.0

asu64.exe set imm.gatewayipaddress1 192.168.xxx.1

asu64.exe set imm.dhcp1 disabled

asu64.exe set rebootimm

Monday, February 23, 2015

Windows Server 2003 Error event 8194 with error code 0x8007000d

Symptoms: 
8194 Group Policy Files NT AUTHORITY\SYSTEM nodename The client-side extension could not remove computer policy settings for '  { }' because it failed with error code '0x8007000d The data is invalid.'

1085 Userenv NT AUTHORITY\SYSTEM nodename. The Group Policy client-side extension Group Policy Files failed to execute. Please look for any errors reported earlier by that extension.


Cause: 
Error event 8194 with error code 0x8007000d is usually caused by a corrupt file in the server’s group policy cache and/or by corruption of Group Policy\History registry hive

Solution:
Clear the Global Policy cache and delete the registry hive on the Windows 2003 server that is exhibiting the problem and get the cache/registry repopulated as per the following:
  • Open Windows Explorer.
  • Save the contents of folder %ALLUSERSPROFILE%\Application Data\Microsoft\Group Policy\History to another location.
  • Delete all files and folders in the History folder.
  • Delete the following registry hives:
  • HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\History
  • HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\History
  • Open Command Prompt and type gpupdate/force .

Tuesday, October 22, 2013

Setting the Refresh Rate for Connectivity Verifiers ISA Server 2006

By default, connectivity verifiers that are enabled test connectivity every 30 seconds. This time can be changed to any value in the range from 15 through 1,440 seconds by setting the RefreshRate property of the FPCConnectivityVerifiers collection. The value of this property applies to all ISA Server computers in an array.

Using Registry:
- Browse To: HKLM\IsaStg_Eff1\Arrays\{D76B4872-115F-49FA-9136-610335ED7F8E}\ConnectivityVerifiers
- Change msFPCRefreshRate value (in dword) as needed

Using Script:
http://technet.microsoft.com/library/cc302480.aspx

You may use sets of Connectivity Verifiers to help you monitoring device such as: AP, WAN, Internal Router especially if combine with email alert triggering.

Sunday, May 12, 2013

Export and Import a readable DHCP scope

Export:
Readable:
netsh dhcp server \\SERVERNAME dump all > filename.txt
Unreadable:
netsh dhcp server \\SERVERNAME export d:\filename all

Full Export with policies (2012) using PS with Administrator Rights
Export-DhcpServer -ComputerName SERVERNAME -File "D:\filename.xml" -Force

Import:
Full Import with policies (2012) using PS with Administrator Rights
Import DhcpServer -ComputerName SERVERNAME -File "D:\filename.xml" -Force

for New 2003 server format
netsh exec filename.txt

for 2000 server format
netsh dhcp server import filename.txt all

Authorize:
1. Activate
2. Authorized from currently authorized DHCP server