Showing posts with label windows. Show all posts
Showing posts with label windows. Show all posts

Find Out Windows SID (Security Identifier) of a Windows Machine:


SID stands for Security Identifier; it is a security principle of the Microsoft Windows network. If you have
created a windows based network then each computer on the network will have a unique SID and that SID is used to identify an object, such as, a user or a group of users in the network. Whenever any specific user in the network tries to access any particular resource, the SID of the requesting user is checked to verify whether the user is authorized to access the resource or not.

Find out the SID of a Windows Computer:

It is very hard to find out the SID of the computer because you need to be a registry geek for this purpose. Instead, you can try out PsGetSid, a free command line utility which lets you view and change the SID.
Download it from the Micosoft website, and then open the command prompt in the administrator mode and run the following command to find out the SID of your machine.

Psgetsid



Shrink a VMware Virtual Machine Disk (VMDK)



In fact, increasing the size of a VMware Virtual Machine Disk (VMDK) is straightforward, and is supported in the vSphere Client, by selecting the virtual hard disk, and increasing the size using the up arrow. or typing in a new value.

However, you cannot shrink the disk in this way, it’s not supported. The only supported method of shrinking a VMware virtual machine disk (VMDK) is to use VMware vCenter Converter Standalone and create a virtual to virtual (V2V)
conversion, a similar process to a Physical to Virtual (P2V) conversion.

The following procedure should be followed to shrink the VMware VM Disk:

1.      RDP to the VM for which the disk size is to be reduced.
2.      Select Disk Management, and select the partition you need to shrink.
3.      Right Click the Volume/Partition to shrink, and select Shrink.
4.      Enter a size to reduce the OS partition.
5.      In this example the VMware virtual machine disk (VMDK) is 30GB, and we would like to reduce the size of the VMware virtual machine disk (VMDK) to 20GB.
6.       Enter the figure 20 (GB) x 1024 = 20480
7.       Now you can see an unallocated 20 GB space on the virtual disk
8.       Power OFF the Virtual Machine, and navigate to the datastore path where the VMware virtual machine disk (VMDK) is located using Putty
9.       We need to edit the *.vmdk, which is the descriptor file, which contains the variables for the size of the *.-flat.vmdk.
10.  The number mentioned under the heading #Extent description, after the letters RW, defines the size of the VMware virtual disk (VMDK).
11.  We wanted to reduce the size of the VMware virtual machine disk (VMDK) from 40 GB to 20 GB. So the value we need to enter into the descriptor file is:-

20 GB = 20 * 1024 * 1024 * 1024 / 512 = 41943040

12.   Using vi, edit the descriptor file, and change the number from 125829120 to 41943040, and save the file.

125829120 is calculated from 80 GB = 80 * 1024 * 1024 * 1024 / 512 = 125829120

13.   Migrate or Copy the virtual machine to another datastore.
14.   After the virtual machine disk (VMDK) has been moved, you will notice the disk size reflects the desired size of 20GB.
15.   After restarting the virtual machine, and checking with Disk Management, you will notice the 20 GB unallocated storage space, has been removed, and disappeared.

How to copy a VM host to host without vCenter


Login to both ESXi hosts that you are copying from and copying to and make sure SSH is enabled.

Make sure the SSH service is started and allowed in ESXi Firewall on both the hosts.

Now ssh into the esxi host 1 which has the VM that needs to be transferred.

Lets give that host ip 10.1.1.1 and the Host 2 that’s going to receive the file will be 10.2.2.2.

You can SSH into the host 1 using putty(win) or terminal (mac)

#ssh root@10.1.1.1
The authenticity of host '10.1.1.1 (10.1.1.1)' can't be established.
RSA key fingerprint is b2:d6:00:34:aa:cc:62:95:8f:d7:f3:1d:59:1e:c3:54.
Are you sure you want to continue connecting (yes/no)? yes

then it will prompt for Password: so enter that.

Start transferring folder:

nohup scp -rv /vmfs/volumes/data-store1/vm-folder-name root@10.2.2.2:/vmfs/volumes/data-store2/

For Multiple VMs (Folders)

First change directory to the Datastore folder

cd /vmfs/volumes/data-store1/

nohup scp -rv vm-folder-1 vm-folder-2 root@10.2.2.2:/vmfs/volumes/data-store2/

Then it’s better to enter multiple VMs leave just a single space between the VM folder name. No quotes or commas.
Now you will be prompted for “host 2” password. enter that and the file transfer will start. The flags used here are -rv, where r is for folder tranfer and v for verbos to watch the progress.

Note: Adding nohup before scp will allow the command to run in background even if you close Terminal/Putty window.

Purpose of Native VLAN in Cisco UCS

Issue:

We have created a service profile that contains 1 vNIC and it is placed in VLAN XX.  I have installed Windows 2008 on a blade using this service profile.  In the OS I have assigned static IP for the NIC in VLAN XX.  From the OS, we cannot ping another device that is in VLAN XX. We cannot ping a host on another VLAN as well.  If we place a check on VLAN 1 as the native VLAN, we still cannot ping anything.  If we place the check for native VLAN to VLAN XX, I can ping hosts within the same VLAN as well as outside the VLAN.  So, why do I need to place VLAN XX as the native VLAN when all my trunks are set up as VLAN 1 being the native VLAN?

Solution:
When allowing certain VLANs on your Service Profile vNICs, you need to set the native VLAN. This is because the way you have it configured currently you're only "allowing VLAN XX, but you're not tagging it. This would work fine for ESXi or any other Hypervisor where you can assign the dot1q tag at the host.  With Windows unless you have specific drivers doing the tagging for you, you'll need to do this at the vNIC level within UCS.
Two ways to see this in action.  When creating a service profile in the "Basic" method - not "Expert", you will select a single VLAN for your interfaces.  This will treat the interfaces pretty much like an "Access Port".  Conversely when you use the "Expert mode you're enable the vNIC as a trunk, in which you will "allow" all the VLANs you'd like access to. Sounds like this is the method you have performed.
For a Windows OS, set the VLAN as Native for the VLAN you want it to access and you'll be sweet.  Unchecking that "Native VLAN" option box is allowing the traffic to traverse out of UCS on the Native VLAN of your network - VLAN 1, which is why it's MAC appears on the other fabric under VLAN1


"RPC server Unavailable" error while trying to RDP

Try putting this registry key in your regedit if you get the above error:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server

Create a new keyword selecting Dword and name it as IgnoreRegUserConfigErrors
Now double click it and give a value as 1

Now try doing an RDP it should work for you .

This issue is normally seen in 2003 servers and the fix works mostly on 2003 servers

Extend System Partition on a Windows Server 2003 VM using Dell ExtPart

There is no native tool that enables extending system partitions (C:\ drives) on Server 2003. There are multiple ways to perform this task using Third party tools, however, the only method that can be done online utilizes a Dell utility called ExtPart. It can perform the extension of the system partition with no downtime although sometimes booting into Safe Mode and then running ExtPart is necessary to clear locks on the disk.
NoteThis applies to Server 2003 only, newer versions of Windows do not suffer from this limitation, Disk Management as well as the diskpart are able to extend system partitions on-the-fly.
1.   The first step is to download the ExtPart utility from this link. Click on the Download File link and save it to your desktop. The file is a self-extracting zip file called ExtPart.exe per the below:
2.   Double-click on it and accept the default path it will extract the utility to.
3.   Click on Unzip and the files will be extracted successfully.
To demonstrate how useful ExtPart is we will use an example whereby our demo VM has a 12 GB C:\ drive and it needs to be increased to 25 GB. A screenshot of the the current state of the C:\ drive is below: 

Ensure that you have 13 GB of unallocated space to next to C drive to extend the partition.
Now we need to run the ExtPart utility expand the C:\ drive so that it utilizes the 13 GB of unallocated space. To proceed, open the command prompt and go to the location where you extracted the ExtPart utility, in my case, C:\dell\ExtPart:
C:\>cd C:\dell\ExtPart

Then run ExtPart.exe:
C:\dell\ExtPart>extpart.exe

Enter the volume that is being expanded, in this example it is the C:\ drive so enter just C: without the backslash:
Volume to extend (drive letter or mount point): C:

Then enter the amount in MB to increase the volume by, I entered 13312:
Size to expand the volume (MB): 13312

The output will confirm the new size of the volume (C:\ drive), which is 25101 MB:
New volume size          :25101 MB (26320895488 bytes)

The full sequence of commands can be seen in the screenshot below:

When going back into Disk Management and re-scanning the disks you can see that the C:\ drive is using all of the provisioned space in the disk:


If the utility returns an error such as “the disk is not accessible” or “unable to connect to C:” then reboot the VM into Safe Mode and then run the same ExtPart commands. This is caused by various services locking the disk and preventing ExtPart from extending the volume. Booting into Safe Mode starts up the OS in a clean state, so only minimal services and drivers will run, thereby allowing ExtPart to expand the volume without interruption.

Link to download DELL Basic Disk Expansion, v.1.0.4, A01


Error message when you restart Windows Server 2008 R2 after you perform a full OS recovery: “Windows failed to start. Status: 0xc000000e”


Symptoms
When you restart for the first time after you perform a full OS recovery of Windows 2008 R2, you receive the following error message:
Windows failed to start. A recent hardware or software change might be the cause. To fix the problem:

1. Insert your Windows installation disc and restart your computer.
2. Choose your language settings, and then click "Next."
3. Click "Repair your computer."

If you do not have this disc, contact your system administrator or computer manufacturer for assistance.

Status: 0xc000000e

Info: The boot selection failed because a required device is inaccessible.
Cause
When you perform a new installation of Windows Server 2008 R2 from a DVD to unallocated space, two partitions are created. During a recovery operation, the contents of the Boot folder are first restored from the ASR Writer backup and then restored again from the backup on drive C. This double restore action causes an inconsistency in the drive GUID definitions within the Boot folder data. This inconsistency leads to the boot error.
Resolution
To recover from this error, use the bcdedit command-line tool. To do this, follow these steps:
1.    Start the server by using Windows Server 2008 R2 media.

2.    Select Repair your computer.


1.    Select Command Prompt.
2.    At the command prompt, run the bcdedit command. Lists of items appear under Windows Boot Manager and under Windows Boot Loader.
3.    Look for the values for the following items :
a.     Under Windows Boot Manager, the Device item should be set to unknown.
b.    Under Windows Boot Loader, theDevice and osdevice items should be set to unknown.

1.    Run the following three commands to correct the settings, and then restart the computer:
a.     bcdedit /set {default} device partition=c:
b.    bcdedit /set {default} osdevice partition=c:
c.     bcdedit /set {bootmgr} device partition=c:
2.    Or, locate X:\Sources\Recovery, and then run StartRep.exe to start a quick automated startup repair utility that corrects boot environment values.
Note This issue occurs only with certain backup tools. When most backup tools are used, you experience no GUID corruption.




How to See Which Group Policies are Applied to Your PC and User Account through the Command Line


Intended for administrators, the Group Policy Results (GPResult.exe) command line tool verifies all policy settings in effect for a specific user or computer. Administrators can run GPResult on any remote computer within their scope of management. By default, GPResult returns settings in effect on the computer on which GPResult is run.

To run GPResult on your own computer:
  1. Click StartRun, and enter cmd to open a command window.
  2. Type gpresult and redirect the output to a text file as shown in Figure 1 below:

gpresult /scope computer /v >gp.txt
gpresult /scope user /v >gp.txt
gpresult /r >gp.txt

  1. Enter notepad gp.txt to open the file. Results appear as shown in the figure below.

Administrators can also direct GPResult to other users and computers. Complete parameters of the tool are shown in the table below.

Using GPResult Command Line Tool
Parameters
Function
/s Computer
Specifies the name or IP address of a remote computer. (Do not use backslashes.) The default is the local computer.
/u Domain\User
Runs the command with the account permissions of the user that is specified by User or Domain\User. The default is the permissions of the current logged-on user on the computer that issues the command.
/p Password
Specifies the password of the user account that is specified in the /u parameter.
/user TargetUserName
Specifies the user name of the user whose RSOP data is to be displayed.
/scope {user|computer}
Displays either user or computer results. Valid values for the /scope parameter are user or computer. If you omit the /scope parameter, gpresult displays both user and computer settings.
/v
Specifies that the output display verbose policy information.
/z
Specifies that the output display all available information about Group Policy. Because this parameter produces more information than the /v parameter, redirect output to a text file when you use this parameter (for example, gpresult /z >policy.txt).
/?
Displays help at the command prompt.

How to See Which Group Policies are Applied to Your PC and User Account through a GUI


1.    The easiest way to see which Group Policy settings have been applied to your machine or user account is to use the Resultant Set of Policy Management Console. To open it, press the Win + R keyboard combination to bring up a run box.
2.    Type rsop.msc into the run box and then hit enter.

3.    You will see a pop-up dialog for the small period of time it take Windows to query your system.
4.    Once the console opens you will be able to see which settings have been applied to your PC.
Note: Only settings that have been applied to your machine and user account will show up.

Robocopy command to copy files and folders with permission and other attibutes


Robocopy "\\192.168.12.1\E$\Important_Data\Data_New" "\\192.168.14.2\E$\Important_Data\Data_New" /S /ZB /MIR /COPYALL /R:3 /W:3 /NP /LOG:Data_Copy.log

/S
Copy Subdirectories, but not empty ones.
/ZB
Use restartable mode; if access denied use Backup mode.
/MIR
MIRror a directory tree (equivalent to /E plus /PURGE).
/COPYALL
COPY ALL file info (equivalent to /COPY:DATSOU).
/R:n
Number of Retries on failed copies: default 1 million.
/W:n
Wait time between retries: default is 30 seconds.
/NP
No Progress - don't display percentage copied.
/LOG:file
Output status to LOG file (overwrite existing log).
/PURGE
Delete dest files/dirs that no longer exist in source.
/E
Copy subdirectories, including Empty ones.


Windows: List Shared Drives and Folders from the Command Line

This Procedure applies to Windows XP Professional, Windows Vista, Windows Server 2003 and Windows Server 2008.
1. Open a command prompt.
2. Execute the following command:

wmic share get caption,name,path

A list of all shared drives and folders will appear, including the path for each shared folder.
If you want to generate a text or HTM file for printing, execute the following:
To generate the output as textfile:

/output:d:\Shared.txt share get caption,name,path

To generate the output as HTM file:

/output:d:\Shared.htm share get caption,name,path

make sure to change the location and filename (d:\Shared.txt or d:\Shared.htm) to the desired values.


Saving and restoring existing Windows shares

SUMMARY
If you need to complete any of the following procedures, you can save the share names that exist on the original Microsoft Windows installation, including any permissions assigned to those shares:  
·         Reinstall Windows over an existing installation (a clean install, not an upgrade).
·         Move all of your data drives from one server to another.
·         Install Windows to another folder or drive on a computer that already has Windows installed.
MORE INFORMATION
To save only the existing share names and their permissions on Windows follow these steps.

Note This procedure applies only to NetBIOS shares and not to Macintosh volumes.
1.    On the existing Windows installation that contains the share names and permissions that you want to save, start Registry Editor (Regedt32.exe).
2.    From the HKEY_LOCAL_MACHINE subtree, go to the following key:
SYSTEM\CurrentControlSet\Services\LanmanServer\Shares
3.    Save or export the registry key.
·         For Windows NT and Windows 2000, click Save Key on the Registry menu.
·         For Windows Server 2003, click Export on the File menu.
4.    Type a new file name (a file extension is not necessary), and then save the file to a floppy disk.
5.    Reinstall Windows.
6.    Run Registry Editor (Regedt32.exe).
7.    From the HKEY_LOCAL_MACHINE subtree, go to the following key:
SYSTEM\CurrentControlSet\Services\LanmanServer\Shares
8.    Restore or import the registry key.
·         For Windows NT and Windows 2000, click Restore on the Registry menu.
·         For Windows Server 2003, click Import on the File menu.
9.    Type the path and file name of the file that you saved in steps 3 and 4.

Caution This step overrides the shares that already exist on the Windows computer with the share names and permissions that exist in the file you are restoring. You are warned about this before you restore the key.
10.  Restart the server.
Note After you complete this procedure, if you decide that you should not have restored the Shares key, restart the computer and press the SPACEBAR to use the last known good configuration. After you restore the shares key, the shares can be used by network clients. If you run the net shares command on the server, the server displays the shares; however, File Manager does not display the shares. To make File Manager aware of the newly restored shares, create any new share on the server. File Manager displays all of the other shares after you restart the server or stop and restart the Server service.

In Windows NT 3.5, if you click Stop Sharing in File Manager, the restored shares are still displayed, but they are dimmed.

Only permissions for domain users are restored. If a local user was created in the previous Windows NT installation, that local user's unique security identifier (SID) is lost. NTFS permissions on folders and files are not affected when you save and restore the shares key.

Properties
Applies to

Microsoft Windows Server 2003, Datacenter Edition (32-bit x86), Microsoft Windows Server 2003, Enterprise Edition (32-bit x86), Microsoft Windows Server 2003, Standard Edition (32-bit x86), Microsoft Windows Server 2003, Web Edition, Microsoft Windows 2000 Server, Microsoft Windows 2000 Advanced Server, Microsoft Windows 2000 Professional Edition, Microsoft Windows NT Server 3.51, Microsoft Windows NT Server 4.0 Standard Edition, Microsoft Windows NT Workstation 3.1, Microsoft Windows NT Workstation 3.5, Microsoft Windows NT Workstation 3.51, Microsoft Windows NT Workstation 4.0 Developer Edition, Microsoft Windows NT Advanced Server 3.1, Windows Server 2008 Datacenter without Hyper-V, Windows Server 2008 Enterprise without Hyper-V, Windows Server 2008 for Itanium-Based Systems, Windows Server 2008 R2 Datacenter, Windows Server 2008 R2 Enterprise, Windows Server 2008 R2 for Itanium-Based Systems, Windows Server 2008 R2 Standard, Windows Server 2008 Standard without Hyper-V, Windows Server 2008 Datacenter, Windows Server 2008 Enterprise, Windows Server 2008 Standard