How to backup and restore GPO Win 2k8 r2 using PowerShell commands

Import-Module GroupPolicy
Backup-Gpo -Name TestGPO -Path C:\GpoBackups -Comment "Weekly Backup"
Backup-Gpo -GUID fa4a9473-6e2a-4b87-ab78-175e68d97bde -Domain -Server DC1 -Path \\Server1\GpoBackups
Backup-Gpo -All -Path \\Server1\GpoBackups

Restore-GPO -Name "TestGPO" -Path \\Server1\Backups
Restore-GPO -GUID fa4a9473-6e2a-4b87-ab78-175e68d97bde -Path \\Server1\Backups
Restore-GPO -All -Domain -Path \\Server1\Backups

How To Troubleshoot Common HTTP Error Codes


When accessing a web server or application, every HTTP request that is received by a server is responded to with an HTTP status code. HTTP status codes are three-digit codes, and are grouped into five different classes. The class of a status code can be quickly identified by its first digit:

  • 1xx: Informational
  • 2xx: Success
  • 3xx: Redirection
  • 4xx: Client Error
  • 5xx: Server Error

This guide focuses on identifying and troubleshooting the most commonly encountered HTTP error codes, i.e. 4xx and 5xx status codes, from a system administrator’s perspective. There are many situations that could cause a web server to respond to a request with a particular error code–we will cover common potential causes and solutions.

Client and Server Error Overview

Client errors, or HTTP status codes from 400 to 499, are the result of HTTP requests sent by a user client (i.e. a web browser or other HTTP client). Even though these types of errors are client-related, it is often useful to know which error code a user is encountering to determine if the potential issue can be fixed by server configuration.

Server errors, or HTTP status codes from 500 to 599, are returned by a web server when it is aware that an error has occurred or is otherwise not able to process the request.

General Troubleshooting Tips

  • When using a web browser to test a web server, refresh the browser after making server changes
  • Check server logs for more details about how the server is handling the requests. For example, web servers such as Apache or Nginx produce two files called access.log and error.log that can be scanned for relevant information
  • Keep in mind that HTTP status code definitions are part of a standard that is implemented by the application that is serving requests. This means that the actual status code that is returned depends on how the server software handles a particular error–this guide should generally point you in the right direction

Now that you have a high-level understanding of HTTP status codes, we will look at the commonly encountered errors.

400 Bad Request

The 400 status code, or Bad Request error, means the HTTP request that was sent to the server has invalid syntax.

Here are a few examples of when a 400 Bad Request error might occur:

  • The user’s cookie that is associated with the site is corrupt. Clearing the browser’s cache and cookies could solve this issue
  • Malformed request due to a faulty browser
  • Malformed request due to human error when manually forming HTTP requests (e.g. using curlincorrectly)

401 Unauthorized

The 401 status code, or an Unauthorized error, means that the user trying to access the resource has not been authenticated or has not been authenticated correctly. This means that the user must provide credentials to be able to view the protected resource.

An example scenario where a 401 Unauthorized error would be returned is if a user tries to access a resource that is protected by HTTP authentication, as in this Nginx tutorial. In this case, the user will receive a 401 response code until they provide a valid username and password (one that exists in the.htpasswd file) to the web server.

403 Forbidden

The 403 status code, or a Forbidden error, means that the user made a valid request but the server is refusing to serve the request, due to a lack of permission to access the requested resource. If you are encountering a 403 error unexpectedly, there are a few typical causes that are explained here.

File Permissions

403 errors commonly occur when the user that is running the web server process does not have sufficient permissions to read the file that is being accessed.

To give an example of troubleshooting a 403 error, assume the following situation:

  • The user is trying to access the web server’s index file, from
  • The web server worker process is owned by the www-data user
  • On the server, the index file is located at /usr/share/nginx/html/index.html

If the user is getting a 403 Forbidden error, ensure that the www-data user has sufficient permissions to read the file. Typically, this means that the other permissions of the file should be set to read. There are several ways to ensure this, but the following command will work in this case:

sudo chmod o=r /usr/share/nginx/html/index.html 


Another potential cause of 403 errors, often intentinally, is the use of an .htaccess file. The .htaccessfile can be used to deny access of certain resources to specific IP addresses or ranges, for example.

If the user is unexpectedly getting a 403 Forbidden error, ensure that it is not being caused by your.htaccess settings.

Index File Does Not Exist

If the user is trying to access a directory that does not have a default index file, and directory listings are not enabled, the web server will return a 403 Forbidden error. For example, if the user is trying to access, and there is no index file in the emptydir directory on the server, a 403 status will be returned.

If you want directory listings to be enabled, you may do so in your web server configuration.

404 Not Found

The 404 status code, or a Not Found error, means that the user is able to communicate with the server but it is unable to locate the requested file or resource.

404 errors can occur in a large variety of situations. If the user is unexpectedly receiving a 404 Not Found error, here are some questions to ask while troubleshooting:

  • Does the link that directed the user to your server resource have a typographical error in it?
  • Did the user type in the wrong URL?
  • Does the file exist in the correct location on the server? Was the resource was moved or deleted on the server?
  • Does the server configuration have the correct document root location?
  • Does the user that owns the web server worker process have privileges to traverse to the directory that the requested file is in? (Hint: directories require read and execute permissions to be accessed)
  • Is the resource being accessed a symbolic link? If so, ensure the web server is configured to follow symbolic links

500 Internal Server Error

The 500 status code, or Internal Server Error, means that server cannot process the request for an unknown reason. Sometimes this code will appear when more specific 5xx errors are more appropriate.

This most common cause for this error is server misconfiguration (e.g. a malformed .htaccess file) or missing packages (e.g. trying to execute a PHP file without PHP installed properly).

502 Bad Gateway

The 502 status code, or Bad Gateway error, means that the server is a gateway or proxy server, and it is not receiving a valid response from the backend servers that should actually fulfill the request.

If the server in question is a reverse proxy server, such as a load balancer, here are a few things to ensure:

  • The backend servers (where the HTTP requests are being forwarded to) are healthy
  • The reverse proxy is configured properly, with the proper backends specified
  • The network connection between the backend servers and reverse proxy server is healthy. If the servers can communicate on other ports, make sure that the firewall is allowing the traffic between them

503 Service Unavailable

The 503 status code, or Service Unavailable error, means that the server is overloaded or under maintenance. This error implies that the service should become available at some point.

If the server is not under maintenance, this can indicate that the server does not have enough CPU or memory resources to handle all of the incoming requests, or that the web server needs to be configured to allow more users, threads, or processes.

504 Gateway Timeout

The 504 status code, or Gateway Timeout error, means that the server is a gateway or proxy server, and it is not receiving a response from the backend servers within the allowed time period.

This typically occurs in the following situations:

  • The network connection between the servers is poor
  • The backend server that is fulfilling the request is too slow, due to poor performance
  • The gateway or proxy server’s timeout duration is too short


Now that you are familiar with the most common HTTP error codes, and common solutions to those codes, you should have a good basis for troubleshooting issues with your web servers or applications.

If you encounter any error codes that were not mentioned in this guide, or if you know of other likely solutions to the ones that were described, feel free to discuss them in the comments!


Configure DHCP Relay Agent

Extracted by Vichhaiy


Def: The DHCP Relay Agent component relays DHCP messages between DHCP clients and DHCP servers on different IP networks.

Note: You cannot use the DHCP Relay Agent component on a computer that is running the DHCP service, the network address translation (NAT) routing protocol component with automatic addressing enabled, or Internet Connection Sharing (ICS).


DHCP server with DHCP relay agent in windows 2012 server

If you have two different networks and you don’t want to install a DHCP Server on each side you can use “DHCP Relay Agent” Service.

Here a quick tutorial: 
1. DHCP-Server 
    Install “DHCP-Server” Role

2. Configure DHCP Scopes 
    Scope A 
    Scope B

3. Router 
    Should have two Network cards. For each network one. 
    Network A IP: 
    Network B IP:

4. Install “Remote Access” Role

5. Run “Routing and Remote Access”

6. “Configure and Enable Routing and Remote Access”

7. Choose “Custom Configuration”

8. Choose “LAN routing” and start the service

9. Install the DHCP Relay Agent 
    Right Click on General in IPv4 and choose “New Routing Protocol” and there you can finally choose “DHCP Relay Agent”.

10. Right Click on” DHCP Relay Agent” and choose “Properties”. There you add your DHCP Server. In this case it would be

11. Add the Network B Interface to the “DHCP Relay Agent”.

12. You should be done. In Windows 2008 it’s possible that you need to make adjustments to your Windows Firewall.

13. You can test on your client to get an IP Adress. Run from the command console: Ipconfig /release and Ipconfig /renew.  

After that you should be able to see the IP address if you type: ipconfig.



How to create multiple users using shell script in Linux

Step 1: create a file name “” with the content below:

for i in `more $1`
echo $i
useradd -m -g G_Staff $i
echo “1234567” | passwd –stdin “$i”

Step 2. set execute permission to this file:
chmod +x

Step 3. create a file name “users.txt” with the contents like below:


Step 4. run this script “” with the file “users.txt”, then it will create user1, user2 & user3 with password “1234567”

./ users.txt

Any question, contact the blog owner.

Cisco Router Password Recovery

The following is the tutorial about how recover a Cisco Passwords (Example: Console Password, Enable Password, Enable secret, VTY Password. But no need to removing case or CMOS Battery)

Step 1: Restart / Power On the Router “R1”


Step 2: Press Ctrl + Break, When the router is booting IOS. This key will interrupt the router boot process and prompt you ROM Monitor (ROMMON) Mode.


Step 3: Change the Configuration Register key to 0x2142 using confreg 0x2142 command. The key 0x2142 used to avoid coping configuration from NVRAM to RAM during next boot process.
Then restart the router using reset command


Step 4: After router restarted you will prompted for Initial Configuration. Type no to avoid Initial Configuration.


Step 5: Now the router with basic default configuration will be loaded. You can verify your passwords by show startup-config in Privilege EXEC mode.


Step 6: Copy the Startup Configuration to RAM by using command copy start run.


Step 7: Now we can remove the password using Global Configuration commands. And the change the configuration register key to 0x2102 (default).

R1#configure terminal
R1(config)#no enable secret

R1(config)#line con 0
R1(config-line)#no password
R1(config-line)#no login

R1(config)#line vty 0 4
R1(config-line)#no password

R1(config)#config-register 0x2102


Step 8: Now save the current configuration to NVRAM by copy running-config startup-config command. And restart the router by reload command.


Finished. Now you can access your router with with no authentication.

Network Tutorials


Windows Server 2012

LPI Linux LPIC-1 101 and CompTIA Linux+

LPI Linux LPIC-1 102 and CompTIA Linux+

CCNA Wireless IUWNE 640-722 

Cisco CCNA Security 640-554

Ubuntu Linux 2013

IPV6 Concepts, Implementation And Verification Of IPv6

Cisco CCIP BGP 642-661 Video Tutorials

Cisco CCDA 640-864: Designing for Cisco Internetwork Solutions Training

Cisco CCNP Security SECURE 642-637

Cisco CCNP SWITCH 642-813



CCIE Routing and Switching Advanced Troubleshooting

The Bryant Advantage CCNP 2013 With Chris Bryant

How to log into Facebook

How do I log into my Facebook account?

  1. Make sure no one else is logged in
    • To log someone else out, click at the top right of any Facebook page and select Log Out
  2. Go to the top of and enter one of the following:
  • Email address: You can log in with any email address that is currently listed on your Facebook account
  • Username: You can also log in with your username
  • Mobile number: If you have a mobile number confirmed on your account you can enter it here (skip the zeros before the country code and any symbols)

Enter your password Click Login

How to Manage Your Facebook Timeline Professionally

What is Timeline review? How do I turn Timeline review on?

Timeline review is part of your activity log and lets you choose whether posts you’re tagged in appear on your Timeline. Posts you’re tagged in can also appear in News Feed, search and other places on Facebook.

When people you’re not friends with tag you in a post, they automatically go to Timeline review. If you’d also like to review tags by friends, you can turn on Timeline review for tags from anyone:

  1. Click at the top right of any Facebook page and select Settings
  2. In the left column, click Timeline and Tagging
  3. Look for the setting Review posts friends tag you in before they appear on your Timeline?and click Edit to the far right
  4. Select Enabled from the dropdown menu

15 Tips to Optimize Your PHP Script for Better Performance for Developers

If you are a developer, it is essential for you to optimize your script early in the development process itself. Following the best practices while coding your PHP script is a good starting point to write a well optimized PHP code.

This tutorial provides few tips to optimize PHP code from a developer point of view.

1. Use Native PHP Functions

As much as possible, try to use native PHP functions rather than writing your own functions to achieve the objective. For example, you can use range( b, k) to get an array of alphabets starting from b to k in sequence, if it is only needed once in the script rather than declaring an array with these values in a function and returning it on its call.

2. Use Single Quotes

Using single quotes ( ‘ ‘ ) is faster than using double quotes( ” ” ) if you are going to keep only the string inside it avoiding any variables. Double quotes checks for the presence of variable and adds little bit of overhead.

3. Use = = =

Use “= = =” instead of “= =”, as the former strictly checks for a closed range which makes it faster.

4. Use Appropriate Str Functions

str_replace is faster than preg_replace, but strtr is faster than str_replace by a factor of 4.

5. Calculate Only Once

Calculate and assign the value to the variable if that value is getting used numerous time rather than calculating it again and again where it is being used.

For example, the following will degrade the performance.

 for( $i=0; i< count($arrA); $i++){ echo count($arrA); } 

The script below will perform much better.

 $len = count($arrA); for( $i=0; i< $len; $i++){ echo $len; } 

6. Pass Reference to Function

Pass reference to the function if it does not affect your logic. A function manipulating the reference is faster than those manipulating the value been passed as here one more copy of the value is getting created. Especially it adds overhead when the value passed by you is a big array.

For example, let us create a function in two different way to increment by 1, each element of an array having values 0 to 99.

 <?php // passing by reference function computeValue( &$param ){ // Something goes here foreach( $param as $k => $value){ $param[$k] = $value + 1; } } $x = array(); for( $i =0; $i<99; $i++){ $x[$i] = $i; } computeValue( $x); // array with 100 elements each incremented by 1 print_r( $x ); ?> 

The function above works faster than the function below although both will produce the same result ( increment each element of the array by 1. )

 <?php // passing by value function computeValue( $param ){ // Something goes here foreach( $param as $k => $value){ $param[$k] = $value + 1; } return $param; } $x = array(); for( $i =0; $i<99; $i++){ $x[$i] = $i; } // array with 100 elements each incremented by 1 print_r(computeValue( $x)); ?> 

7. Create Classes Only When its Required

Don’t create classes and method until and unless its really needed, used and reused as well.

8. Disable Debugging Messages

File operations are expensive. So, if you have written lot of custom functions to log errors and warning during your development process, make sure you remove them before you push the code to production.

9. Use Caching Techniques

Use cache to reduce the load of database operations as well as the script compilation. We can use memcache for the reducing database load and APC for opcode caching and intermediate code optimization.

10. Close the Connection

Get into the habit to unset the variables and close database connection in your PHP code. It saves memory.

11. Reduce Number of Hits to DB

Try to reduce the number of hits to the database. Make queries aggregate so that you call the database less number of times. For example:

 <?php $con=mysqli_connect("localhost","username","somepassword","anydb"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL" ; mysqli_connect_error(); } function insertValue( $val ){ mysqli_query($con,"INSERT INTO tableX (someInteger) VALUES ( $val )"); } for( $i =0; $i<99; $i++){ // Calling function to execute query one by one insertValue( $i ); } // Closing the connection as best practice mysqli_close($con); ?> 

The script above is much slower than the script below:

 <?php $con=mysqli_connect("localhost","username","somepassword","anydb"); if (mysqli_connect_errno()) { echo "Failed to connect to MySQL" ; mysqli_connect_error(); } function insertValues( $val ){ // Creating query for inserting complete array in single execution. $query= " INSERT INTO tableX(someInteger) VALUES .implode(',', $val)"; mysqli_query($con, $query); } $data = array(); for( $i =0; $i<99; $i++){ // Creating an array of data to be inserted. $data[ ] = '(" ' . $i. '")' ; } // Inserting the data in a single call insertValues( $data ); // Closing the connection as a best practice mysqli_close($con); ?> 

12. Frequently Used Switch Cases

Keep most frequently used switch cases on the top.

13. Use Methods in Derived Classes

Methods in derived classes are faster than base classes. For example, let there be a function in both base class and derived class for performing task1. It is named as “forTask1″ in base class and “forTask1again” in derived class, so that they will not override.

Call to the function “forTask1again( )” which is in derived class will work faster than call to the function “forTask1( )” as it is from base class.

 <?php class someBaseClass { public function forTask1($string) { // perform task 1 } public function forTask2( ) { // perform task 2 } } class derivedClass extends someBaseClass { public function forTask1again($string) { //perform task 1 same as the function in base class. } public function forTask3($string) { //perform task 3 } } //Instantiating the derived class below. $objDerivedClass = new derivedClass( ); // The call below works slow for task1 as it is from base class. $resultTask1 = $objDerivedClass->forTask1( ); // The call below works faster for task1 as // it is from derived class. $sameResultTask1 = $objDerivedClass->forTask1again(); ?> 

14. Use JSON

Use JSON instead of XML while working with web services as there are native php function like json_encode( ) and json_decode( ) which are very fast. If you are bound to have XML form of data, then use regular expression to parse it instead of DOM manipulation.

15. Use isset

Use isset( ) where ever possible instead of using count( ), strlen( ), sizeof( ) to check whether the value returned is greater than 0.

For example, let us assume that you have a function which returns an array with values or a NULL array. Now you want to check whether the returned array is with values or not, then use the following:

 if(isset($returnValue)){ // do something here } 

In this case, use the above code block, instead of the following:

 if(count($returnValue) > 0){ // do something here }

​ Home Personal Computer (PC) Maintenance for Windows Operating Systems – pdf

Newsletter for branding (word doc)

From the Desk of William F. Pelgrin, Chair

Why do I need to maintain my home PC?

As with most types of equipment, you must perform periodic maintenance on your home PC to keep it in good operating condition. Performing maintenance will help your PC run faster, use resources more efficiently, and could save you from headaches caused by system failures and degradation. Most importantly, proper PC maintenance is crucial in order to protect your machine from security threats such as worms, viruses and other malicious activity.

How do I keep my home PC maintained?

Note: The following steps are provided to help ensure that your home PC operates effectively and securely. Most of the tips can be performed with moderate knowledge of PCs and can generally be completed in a short time. More detailed, in-depth assistance may be required in some instances, in which case you may wish to consult a qualified computer repair professional.

  • Establish and maintain a plan. Make a plan to perform periodic maintenance and put it on your calendar as a reminder. Back up critical files system files and programs before beginning.
  • Set a System Restore Point. Before you begin your periodic maintenance or make any significant changes, set up a system restore point, which will enable recovery from any error that may occur during maintenance. To set a System Restore Point, click Start, All Programs, Accessories, System Tools, System Restore, Create a Restore Point. (For "Classic" Start Menu: click Start, Programs, Accessories, System Tools, System Restore, Create a Restore Point.)
  • Remove unnecessary files or programs. Empty your Recycle Bin and delete Windows temporary files. Remove installed programs that you no longer use. The Disk Cleanup program does all of these tasks including the deletion of unneeded Windows components. To access the Windows Disk Cleanup program, click: Start, All Programs, Accessories, System Tools, Disk Cleanup. (For "Classic" Start Menu, click: Start, Programs, Accessories, System Tools, Disk Cleanup.)

    In Internet Explorer, clear your history, temporary Internet files, and cookies by clicking on Tools, Internet Options and select the tab labeled "General." Click on the Delete button under the section labeled "Browsing history."

    Finally, archive or delete old files such as documents, images and graphics that are no longer needed.

  • Optimize system performance. Configuring your PC software to operate as efficiently as possible will help your PC run faster and smoother. Organize your data files in a central folder with appropriate subfolders (do not save files in the root directory or on the desktop). This makes backup easier and can reduce fragmentation on your hard drive.
  • Run a defragment tool on your disk drive. To do so, click Start, All Programs, Accessories, System Tools, Disk Defragmenter. (For "Classic" Start Menu, click Start, Programs, Accessories, System Tools, Disk Defragmenter.)
  • Apply updates and patches. Make sure your operating system and software applications have the latest updates installed-and that the auto-update feature is enabled. Ensure that your anti-virus/anti-spyware/anti-adware software are running and receiving automatic updates. Check vendor and manufacturer websites for device drivers updates, and apply patches as needed. Renew all maintenance contracts/subscriptions.
  • Perform regular backups. All critical files, as well as any information not easily replaced should be backed up. Check backup functions to ensure they are operating properly. Back up your files to a remote location (external hard drive or PC).
  • Check your firewall. Review firewall settings for product configurations. Confirm that settings are appropriate for the current level of security needed.
  • Routinely change your passwords. Routinely change all of your passwords for local applications, as well as those used for websites. Use strong passwords with at least eight characters and incorporate a mix of numbers, special characters, and upper and lower case letters.
  • Perform hardware inspections. Perform a visual check of your PC hardware to prevent potential problems before they occur. This includes examining your surge suppressor, UPS, power strip, and cables for any damage. Replace batteries as needed. ​
By vichhaiy Posted in HowTo