Search This Blog

Saturday, December 31, 2011

Sunday, December 25, 2011

Using Batch Files to Automate Networking Tasks - PART3


How to Restart Services On All Domain Controllers Within a Domain

To restart service on all domain controllers within a domain, perform the following steps: 

  1. Create the Restart.bat and Restart2.bat files listed below.
  2. Run the Restart.bat Service Name from a computer running Windows NT using administrator privileges. The Restart.bat file issues the Windows NT Resource Kit utility NETDOM to create a file called Netdom.txt. The Netdom.txt file gets parsed using the FOR command (part of Windows NT command extensions). Each \\DomainControllerName gets passed to the Restart2.bat file where the Windows NT Resource Kit utility NETSVC command gets issued to stop and start the Service Name entered at the command prompt.
Filename: RESTART.BAT 

echo off
cls
if (%1)==() goto NoParams
netdom bdc > netdom.txt
for /F "skip=6 tokens=4" %%a in (netdom.txt) do call restart2.bat
%%a %1
echo ---------
echo - Done! -
echo ---------
goto bottom
:NoParams
echo usage: RESTART "Service Name"
echo.
echo. i.e.- RESTART "License Logging Service"
echo.
:bottom
    

Filename: RESTART2.BAT 

echo Restarting %2 on %1
netsvc %2 %1 /stop
netsvc %2 %1 /start
echo.
  

Using Batch Files to Automate Networking Tasks - PART2


How to Add Files to Many Users' Home Directories

To add files to many users' home directories, perform the following steps: 

  1. Create the Addfile.bat and Addfile2.bat files listed below.
  2. Run Addfile.bat <Parent Directory> <File to Add> with administrative privileges from a computer running Windows NT. The Addfile.bat file simply issues a DIR command and redirects the output to a file, which in turn gets parsed using the FOR command (part of Windows NT command extensions). The Addfile2.bat file gets called once for each directory name listed in the Dir.txt file. The Addfile2.bat file issues a copy command to copy the file to each user directories.
Filename: ADDFILE.BAT
v
echo off
cls
IF (%1)==() GOTO NoParams
IF (%2)==() GOTO NoParams
Echo Creating directory listing...
dir %1 > dir.txt
for /F "skip=7 tokens=4" %%a in (dir.txt) do call addfile2.bat %%a
%1 %2
echo ---------
echo - Done! -
echo ---------
GOTO Bottom
:NoParams
ECHO usage: ADDFILE [Parent Directory] [File to Add]
ECHO.
ECHO  i.e.- ADDFILE C:\PROFILES MyFile.lnk
ECHO.
:Bottom
    

Filename: ADDFILE2.BAT 
if (%1)==() goto bottom
if (%1)==(bytes) goto bottom
copy %3 %2\%1
:bottom
    

Using Batch Files to Automate Networking Tasks - PART1

This article demonstrates a few ways to use Windows NT command extensions in conjunction with Windows NT Resource Kit utilities within batch files to automate common networking tasks. 

The following tasks will be illustrated: 

  • How to automate the addition of Domain\Domain Users global group to each of the member servers Change the system time user right.
  • How to add files to many users' home directories.
  • How to restart services on all domain controllers within a domain.

How to Automate the Addition of Domain\Domain Users

How to automate the addition of "Domain\Domain Users" global group to each of the member servers "Change the system time" user right. 

  1. Create the Addtime.bat and Addtime2.BAT files listed below.
  2. Run Addtime.bat with administrator privileges from a computer running Windows NT. This batch file creates a list of member servers using the Windows NT Resource Kit utility Netdom.exe. The output of NETDOM gets redirected to a file, which in turn, gets parsed using the FOR command (part of Windows NT command extensions). The Addtime2.bat file gets called for each instance of \\ServerName within the Netdom.txt file. The Addtime2.bat file then issues the Windows NT Resource Kit utility Ntrights.exe to add Domain\Domain Users global group to each of the member servers Change the system time user right. The output of NTRIGHTS gets written to a file called Log.txt.
Filename: Addtime.bat 

echo off
cls
echo Creating a list of member servers.
echo.
netdom member > netdom.txt
echo Adding "Change System Time" right to Member Servers...
echo.
if exist log.txt del log.txt
for /F "skip=6 tokens=4" %%a in (netdom.txt) do 
   call ADDTIME2.bat %%a
echo.
echo ----------------------------------------------
echo - Done! Check LOG.TXT for status information.-
echo ----------------------------------------------
    


Filename: ADDTIME2.BAT 

echo Adding right to %1...
ntrights -u "domain users" -m %1 +r SeSystemTimePrivilege >> log.txt
    

Friday, December 23, 2011

HAPPY X' MAS

:)

How To Add Users To Your Samba Domain - PART13


Adding users to a domain has three broad phases. The first is adding a Linux user on the Samba server, the second is creating a Samba smbpasswd that maps to the new Linux user created previously, and the third is to map a Windows drive letter to the user's Linux home directory. Let's take a closer look:

Adding The Users In Linux

First, go through the process of adding users in Linux just as you would normally. Passwords won't be necessary unless you want the users to log in to the Samba server via telnet or ssh.

Create the user

To create the user, use the command:
[root@bigboy tmp]# useradd -g 100 peter

Give them a Linux Password

Giving them a Linux password is only necessary if the user needs to log into the Samba server directly. If the user does, use this method:
[root@bigboy tmp]# passwd peter
Changing password for user peter.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
[root@bigboy tmp]#

Mapping The Linux Users To An smbpassword

Next, you need to create Samba domain login passwords for the user
[root@bigboy tmp]# /usr/bin/smbpasswd -a username password
The -a switch adds the user to the /etc/smbpasswd file. Use a generic password then have users change it immediately from their workstations in the usual way.
Remember the smbpasswd sets the Windows Domain login password for a user, which is different from the Linux login password to log into the Samba box.

Mapping A Private Windows Drive Share

By default, Samba automatically gives each user logged into the domain an H: drive that maps to the /home/username directory on the Linux box.

Mapping Using "My Computer"

If the auto-mapping doesn't work then try:
  1. Let the user log into the domain.
  2. Right-click on the "My Computer" icon on the desktop.
  3. Click on "Map Network Drive".
  4. Select a drive letter.
  5. Browse to the HOMENET domain, then the Samba server, then the user's home directory.
  6. Click on the check box "Reconnect at Logon", to make the change permanent

Mapping from the Command Line

If you find the "My Computer" method too time consuming for dozens of users or if the PC doesn't have the feature available, then you can use the command-line method and possibly make it into a script.
1. Create a master logon batch file for all users
[root@bigboy tmp]# vi /home/samba/netlogon/login.bat
2. Add the following lines to mount the user's share as drive P: (for private).
REM Drive Mapping Script
net use P: \\bigboy\
3. Make the file world readable using:
[root@bigboy tmp]# chmod 644 /home/samba/netlogon/login.bat
4. Linux and Windows format text files slightly differ. As the file resides on a Linux box, but will be interpreted by a Windows machine, you'll have to convert the file to the Windows format. Use the unix2dos command.
[root@bigboy tmp]# unix2dos /home/samba/netlogon/login.bat
unix2dos: converting file /home/samba/netlogon/login.bat
to DOS format ...
[root@bigboy tmp]#
5. The final step is to edit your smb.conf file's [global] section have a valid entry for the logon script parameter. This can be done using SWAT via the Globals menu.
[global]
  logon script = login.bat
Now your users will have additional disk space available on a Windows P: drive whenever they login.

Setup Microsoft Windows 2008 R2 Failover Cluster in VMware Workstation - PART1


Microsoft Windows 2008 R2 Failover Cluster
Here you can see how to setup Microsoft Windows 2008 R2 failover cluster in VMware Workstation.This article contains step by step method on Microsoft windows 2008 R2 failover cluster with freenas iscsi disks in VMware workstation just on your computer.  if you search on internet about setting up Windows 2008 R2 cluster in any desktop virtualization software, you can’t find it in one place.
Installation and setup procedure for MS windows 2003 cluster and earlier versions are available on internet, but not Windows 2008 or R2 failover cluster. Everybody including me stuck in one place while setting up Windows 2008 or R2 cluster in Virtualization environment, which is Cluster disk validation.  This is the main issue on MS windows 2008 R2 cluster in VMware workstation or Sun virtual box desktop virtualization software.
Windows 2008 and R2 failover clusters require SCSI-3 persistent reservation target disks as their cluster disks. Now question is how to setup SCSI-3 persistent reservation cluster disks in VMware workstation? I already wrote an article on setting up SCSI-3 persistent reservation cluster  iSCSI disksin VMware workstation using FreeNAS. Before continue reading this post, please read my previous article and create cluster disks in your VMware workstation according to cluster need.
Let’s start the installation and setup of Windows 2008 or R2 Failover cluster in desktop virtualization software VMware workstation.
Required Software
a)      VMware workstation
b)      Windows 2008 or R2 Operating System
c)       FreeNAS
Prerequisites setup
a)      Installation of Windows 2008 or R2 Operating System in VMware Workstation ( Three Windows 2008 R2 Server virtual machines required.  One as domain controller and other twos as cluster nodes)
b)      Setup domain on one server and join other two servers with domain. Use domain administrator login for servers. ( in this example, domain name is sysprobs.net and cluster server names are vm-clus1 and vm-clus2)
c)       Install failover cluster feature in two windows 2008 or R2 servers you are going to setup failover cluster in VMware workstation.
d)      Install second network card in both cluster servers. Give two separate IP addresses, so both servers can communicate through this network also. This network will be used as ‘heart beat’ network for both servers. Make sure, this network name is identical in both servers. (in this example, heart beat network named as ‘ internal’ on both servers)
e)      Create cluster disks in your FreeNAS virtual machine.   Read my previous post on creating SCSI-3 persistent reservation target iSCSI disks in FreeNAS.
( in this example,
Qurom disk – 512MB,
Storage disk1- 2GB,
Storage disk 2- 2GB,
Storage disk 3 – 2GB,
and Backup disk 4GB)
Microsoft Windows 2008 R2 Failover Cluster

Wednesday, December 21, 2011

Make Your PC Clients Aware Of Your Samba PDC (SAMBA) - PART12


There are many types of Windows installed on people's PCs and each version has its own procedure for joining a domain. The next sections show you how to add the most popular versions of Windows clients to your domain:

Windows 95/98/ME and Windows XP Home

Windows 9x machines do not implement full domain membership and therefore don't require machine trust accounts. Here's what you need to do:
  1. Navigate to the Network section of the Control Panel (Start ->Settings->Control Panel->Network)
  2. Select the Configuration tab
  3. Highlight "Client for Microsoft Networks"
  4. Click the Properties button.
  5. Check "Log onto Windows NT Domain", and enter the domain name.
  6. Click all the OK buttons and reboot!

Windows NT

For Windows NT, you must first create a manual Samba machine trust account as explained earlier, then follow these steps:
  1. Navigate to the Network section of the Control Panel (Start ->Settings->Control Panel->Network )
  2. Select the "Identification" tab
  3. Click the "Change" button
  4. Enter the domain name and computer name, do not check the box Create a Computer Account in the Domain. In this case, the existing machine trust account is used to join the machine to the domain.
  5. Click "OK". You should get "Welcome to <DOMAIN>" message as confirmation that you've been added.
  6. Reboot.
You can now log in using any account in the /etc/smbpasswd file with your domain as the domain name.

Windows 200x and Windows XP Professional

For the 200x and XP Professional varieties of Windows, create a dynamic Samba machine trust account, then go through these steps:
  1. Press the Windows and Break keys simultaneously to access the System Properties dialogue box.
  2. Click on the 'Network Identification' or 'Computer Name' tab on the top.
  3. Click the "Properties" button.
  4. Click on the "Member of Domain" button.
  5. Also enter your domain name and computer name and then click "OK"
  6. You will be prompted for a user account and password with rights to join a machine to the domain. Enter the information for your Samba administrator. In this home environment scenario, the user would be root with the corresponding smbpasswd password. Now, you should get a "Welcome to <DOMAIN>" message confirming that you've been added.
  7. Reboot.
Log in using any account in the /etc/smbpasswd file with your domain as the domain name.
Note: With Samba version 2 you may also have to make a few changes to your system's registry using the regedit command and reboot before continuing.
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netlogon\Parameters]
"requiresignorseal"=dword:00000000
"signsecurechannel"=dword:00000000

Friday, December 16, 2011

Is That Grinding Sound the Death of My Hard Drive?


Ericuse165 has a friend with a PC that's making a grinding noise. Eric asked the Hard Drives, NAS Drives, Storage forum for advice.

First, backup that hard drive. And I mean now! That drive could die any minute, and when it does, it will cost hundreds or even thousands of dollars to retrieve your files--if the files can be retrieved.

Do a full image backup of the entire drive, including all partitions. EASEUS Todo Backup andMacrium Reflect Free are both free and either one will do the job just fine. You'll need an external hard drive to back the images onto.

Both programs also have an option for creating a bootable CD from which you can restore the backup. Create that CD.

Backed up? Good. Now you need to determine if it’s the hard drive making the noise, or just a fan.

If the PC is a desktop, open it up, turn it on, and try to locate the location of the noise. If you can't, find yourself a hollow tube--the cardboard one from a used-up paper towel roll works. Holding one end of tube to your ear, point the other end to various locations in the PC, especially towards the hard drive and fans. You'll easily pinpoint the source of the grinding.

Laptops aren't that easy. If you feel comfortable opening yours, use the desktop instructions above. Otherwise, try to determine the location of the fan and the hard drive from the outside. The fan is probably near a vent. Most laptops are designed to make hard drives easy to remove and replace. If you can't find where the drive is located, check your model's online manual.

Once you know where everything is, use the cardboard tube method described above.

If the noise is coming from a fan, and the PC is open, look for something obstructing the fan. Remove it if you find it. If the fan is loose; tighten it. Otherwise, replace it.

But if a fan is making the noise, and you're not comfortable opening the laptop, bring it to a professional and explain the problem.

And if it really is the hard drive making the noise? Buy a new hard drive, install it, and restore Windows and your files from that image backup.

Read the original forum discussion.

Contributing Editor Lincoln Spector writes about technology and cinema. Email your tech questions to him at answer@pcworld.com, or post them to a community of helpful folks on the PCW Answer Line forum. Follow Lincoln on Twitter, or subscribe to the Answer Line newsletter, e-mailed weekly.

PC Dies Before It Can Begin to Boot


When Kennyrosenyc turns on his PC, it dies before it even begins to boot. He asked the Windows forum for help.

You can't blame this one on Windows. If the PC shuts down before it tries to boot off the hard drive (or off of a CD or flash drive), then you definitely have a hardware problem. And the piece of hardware that's giving you the problem is almost certainly not the hard drive.

You're going to have to decide between fixing or replacing the computer. But before you do that, you must rescue your files--especially if you don't have a recent backup.

Since you can't boot off a CD or flash drive, and therefore can't use a live Linux variant, you'll have to remove the hard drive from the old computer and attach it to another computer as a second drive. I can't tell you how to remove the hard drive for your particular model, but you can probably find instructions online. It isn't difficult.

If the working PC is a desktop, you can open it up and install the broken PC's drive as a second, non-booting drive. Or you can borrow or buy an SATA/USB or IDE/USB adapter that will turn the old drive temporarily into an external one. These adapters sell for anything from $15 to $30, and are your only real option if that working computer is a laptop, or if you borrowed the working PC and the owner doesn't want you opening it.

Once a working computer can access the drive, you can copy your files to another location.

Now that you've saved your files, let's get back to the original question: Repair or replace?

If the fan won't start or dies soon after it does, the problem is likely your power supply. If you have a desktop PC, power supplies are cheap (some less than $30) and easy to replace. It might be worth a gamble to see if that's your problem before you try anything else.

Otherwise, unless you're particularly skilled at working with computer hardware, I'd recommend taking it to a professional. On the other hand, if the PC getting old, replacing it may make more sense.

Thursday, December 15, 2011

How To Add Workstations To Your Samba Domain (SAMBA) - PART11


Adding workstations to a Samba domain is a two step process involving the creation of workstation trust accounts on the Samba server and then logging into each workstation to add them to the domain.

Create Samba Trust Accounts For Each Workstation

PDCs will accept user logins only from trusted PCs that have been placed in its PC client database. Samba can create these Machine Trusts in two ways, either manually or automatically.

Manual Creation Of Machine Trust Accounts (NT Only)

The commands in this example create a special Linux group for Samba clients and then add a special machine user that's a member of the group. The password for this user is then disabled and the machine is then added to the smbpasswd file to help keep track of which devices are members of the domain. In summary, a machine trust account needs to have entries in the /etc/passwd and /etc/smbpasswd files. Pay careful attention to the dollar sign ($) at the end and replace machine_name with the name of the Windows client machine.
[root@bigboy tmp]# groupadd samba-clients
[root@bigboy tmp]# /usr/sbin/useradd -g samba-clients \
-d /dev/null -s /bin/false machine_name$
[root@bigboy tmp]# passwd -l machine_name$
[root@bigboy tmp]# smbpasswd -a -m machine_name
This is the only way to configure machine trusts using Windows NT.

Dynamic Creation of Machine Trust Accounts

Although you can use the manual method, the recommended way of creating machine trust accounts is simply to allow the Samba server to create them as needed when the Windows clients join the domain which known as making a machine account on the fly. You can set this up by editing the /etc/samba/smb.conf file to automatically add the required users.
The easiest way to do this using SWAT in the Global menu to modify the add machine script parameter.
[global]
# <...remainder of parameters...>
add machine script = /usr/sbin/useradd -d /dev/null -g samba-clients -s /bin/false -M %u
When you have completed the modifications, you'll need to create the samba-clients Linux group that will be used to help identify the all the domain's Windows clients listed in the /etc/passwd file.
[root@bigboy tmp]# groupadd samba-clients
In Samba version 2, you need to add the client to the smbpasswd file also
[root@bigboy tmp]# smbpasswd -a -m machine_name
Samba version 3 adds it automatically.

Tuesday, December 13, 2011

OPA-Backup is able to backup the product activation of Microsoft Office

OPA-Backup is able to backup the product activation of Microsoft Office XP, 2003, 2007 and 2010. After reinstalling Windows, it restores the backup so that there is no need for activating Office again
To use OPA-Backup, please follow the rules listed below:


  • You must have bought Microsoft Office.
  • Microsoft Office has to be activated.
  • You must fulfill the software license agreement of Microsoft Office.
  • OPA-Backup is not directed against Microsoft.
  • OPA-Backup is no illegal crack.
Requirements: Microsoft Windows, Microsoft .NET Framework 3.0
For More Details:

Sunday, December 11, 2011

How To Create A Samba PDC Administrator User (SAMBA) - Part10


To do both SWAT and user administration with Samba you'll need to create administrator accounts on the Samba PDC Linux server.

Home Environment

By default, the root user is the Samba administrator, and SWAT requires you to use the Linux root password to be used. Fortunately, you can add workstations to the Windows domain by creating a Samba specific root password. This is done using the smbpasswd command.
[root@bigboy tmp]# /usr/bin/smbpasswd -a root password
Note: Remember that regular Linux logins via the console, Telnet or SSH require the Linux passwd command. Samba domain logins use the smbpasswd password. Samba passwords are stored in the /etc/samba/smbpasswd file.

Corporate Environment

In a corporate environment, you may want more than one person to administer Samba, each with their own usernames. Here are the steps to do this:
1. Create a Linux user group, such as sysadmin with the groupadd command.
2. Use SWAT to update your smb.conf file so that the sysadmin group is listed in the [global] parameter settings.
domain admin group = @sysadmin
admin users = @sysadmin
printer admin = @sysadmin
3. Create individual Linux users that are part of this group.
4. Use the smbpasswd command to create Samba passwords for Domain logins for this group. For security reasons this password may be different from the Linux password used to log into the Linux system from the console, via telnet or ssh. (Remember that Linux passwords are changed with the passwd command.)

Samba Passwords (SAMBA) - PART9


You should be aware that your Linux password and Samba passwords are stored in two different locations. This provides the Samba administer the flexibility of allowing only some of the Linux users to have Samba accounts.
Use the passwd command to change Linux passwords, which are stored in the /etc/shadow file. Samba passwords are stored in the /etc/samba/smbpasswd file and can be changed smbpasswd command.
This difference is important.

The [printers] Share Section (SAMBA) - PART8


Samba has special shares just for printers, and these are configured in the [printers] section of SWAT. There is also a share under [printers] called printers which governs common printer settings. Print shares always have the printable parameter set to yes. The default smb.conf [printers] share section looks like this:
[printers]
    comment = All Printers
    path = /var/spool/samba
    printable = Yes
    browseable = No

Wednesday, December 7, 2011

The [netlogon] and [profiles] Share Sections (SAMBA, SWAT) - PART7


The [netlogon] share section contains scripts that the windows clients may use when they log into the domain. The [profiles] share section stores settings related to the look and feel of windows so that the user has the same settings no matter which Windows PC is logged into. The [profiles] share section stores things such as favorites and desktop icons.
Your smb.conf file should look like this when you're finished:
[netlogon]
       path = /home/samba/netlogon
       guest ok = Yes

[profiles]
       path = /home/samba/profiles
       read only = No
       create mask = 0600
       directory mask = 0700
Here's how to do it.
  1. Click the Shares button.
  2. Create a [netlogon] share.
  3. Modify the path and guest ok settings.
  4. Click on the Commit Changes button.
  5. Create a [profiles] share section.
  6. Modify the path, mask and read only settings. The mask settings allow only the owner of the netlogon subdirectory to be able to modify its contents.
  7. Click on the Commit Changes button.
Remember to create these share directories from the command line afterwards.
[root@bigboy tmp]# mkdir -p /home/samba/netlogon
[root@bigboy tmp]# mkdir -p /home/samba/profile
[root@bigboy tmp]# chmod -R 0755 /home/samba