Archive for the ‘Windows’ Category


This step-by-step article describes how to change a GUID partition table (GPT) disk into a master boot record (MBR) disk (64-bit only). But I have tried these on Virtual disk and that does not work .

Using the Windows Interface

  1. Right-click My Computer and click Manage.
  2. Click Disk Management.
  3. Right-click the GPT disk you want to change into an MBR disk, and then click Convert to MBR disk.

Using a Command Line

  1. At a command prompt, type: diskpart, and then press ENTER.
  2. At the diskpart prompt, type: list disk, and then press ENTER.
  3. Record the disk number of the disk that you want to convert to an MBR disk.
  4. At the diskpart prompt, type: select disk n, and then press ENTER.
  5. At the diskpart prompt, type: convert mbr, and then press ENTER.

You must be logged on as an administrator or a member of the Administrators group to complete this procedure. If your computer is connected to a network, the network policy settings may prevent you from completing this procedure.

On Itanium-based computers, you can change a disk from GPT to MBR, provided that the disk is empty.

Ref : Microsoft.com

Advertisements

How to delete GPT Protective Partition

Posted: February 20, 2011 in Windows
Tags:

In Windows XP Professional, if you cannot access or modify GPT disk, you can convert a GPT disk to MBR by using the clean command in DiskPart, which will remove all data and partition structures from the disk.

1. You might see USB Drives in GPT status.

2. Go to DOS command line (click on “Start Menu”, then “Run”, type in “cmd” in textbox, and hit “OK”)

  • Type in “DiskPart” in command line.
  • Type in “list disk” in command line to show all disks in this machine.
  • Use “select” to set the focus to the specified partition.
    For example “select disk 1″.
  • Use “clean” command to remove GPT disk from the current in-focus disk by zeroing sectors.

3. Go back to Disk Management, you can see USB disks are “unallocated” now. Right click on disk info, choose “Initialize Disk”.

4. Choose all drives in USB and initialize them.

Warning: This command will erase all data on the disk, so please backup your data first.


This script will mount user share from a Samba . It run on system startup ..Take the username and run a specific VB Script from a PC and mount the required share . Put the first script on system startup
======================================================================================================
@echo off
for /f “tokens=3 delims=\” %%i in (“%USERPROFILE%”) do (set user=%%i) 2>&1
echo “logged in user:%user%”
set var=%user%

net use U: \\10.80.0.38\NetScripts wizard /user:opennms
copy U:\”%var%”.vbs c:\
cd C:\
“%var%”.vbs
del C:\”%var%”.vbs
net use U: /d
======================================================================================================

Then put this VBS script on the other network PC .According to this example I have put this vb script as mohammada.VBS ON 10.80.0.38 on share NetScripts.

======================================================================================================
‘ ########################################################################
‘ Written in VBScript.
‘ Establishes map drives.
‘ Assign to OU Group Policy under USER CONFIG, WINDOWS SETTINGS, SCRIPTS, LOGON SCRIPT.

‘ This script will:
‘ (1) check if the drive is already connected and, if so, disconnect it.
‘ (2) map the drive.

‘ Arguments are as follows:
‘ MAPIT DRIVE-LETTER as string, PATH as string, USER as string, PASSWORD as string
‘ (1) Do not specify colon in drive letter.
‘ (2) Do not end path with a forward slash.
‘ (3) If user and password are not required to establish map, then specify a zero-length string as follows: “”

‘ Reference Microsoft info at:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsmthmapnetworkdrive.asp
‘ ########################################################################

‘ Create the Shell or environment for the commands:
Set WshShell = WScript.CreateObject(“WScript.Shell”)
‘ Define objects:
Set WshNetwork = WScript.CreateObject(“WScript.Network”)
Set oDrives = WshNetwork.EnumNetworkDrives()

‘ ====================================
‘ DEFINE WHO TO CONTACT for pop-up messages:
‘ ====================================
strContactMessage = “If you require assistance, please contact IT Support.”

‘ ==================
‘ DEFINE DRIVES TO MAP:
‘ ==================
Mapit “F”, “\\10.80.0.2\Fshared”, “administrator”, “password”
Mapit “B”, “\\10.80.0.3\BBoat”, “administrator”, “password”
Mapit “X”, “\\10.80.0.1\Shared”, “mohammada”, “password”
Mapit “R”, “\\10.80.0.1\it_tech”, “mohammada”, “password”
Mapit “Z”, “\\10.80.0.1\Common”, “mohammada”, “password”
Mapit “H”, “\\10.80.0.1\MohammadA”, “mohammada”, “password”

‘ ========
‘ CLEAN UP:
‘ ========
Set WshShell = Nothing
Set WshNetwork = Nothing
Set oDrives = Nothing

‘ ##################################
‘ DO NOT MODIFY ANYTHING BELOW THIS POINT…
‘ unless you are familiar with the proper settings.
‘ ##################################
Sub Mapit(strLetter, strPath, strUser, strPass)

‘ Define the DriveLetter:
DriveLetter = strLetter & “:”

‘ Define the remote path:
RemotePath = strPath

‘ Pop-up Notices (set to False to disable notices, otherwise set to True):
bPopReminder = True

‘ Define known errors to trap:
Dim arrErrCode(1)
Dim arrErrDesc(1)
arrErrCode(0) = -2147023694
arrErrCode(1) = -2147024811
arrErrDesc(0) = “Unable to map drive ” & DriveLetter & ” to ” & RemotePath _
& ” due to a previously defined remembered map with the same letter.” _
& vbCrLf & vbCrLf & “Please MANUALLY disconnect map drive ” & DriveLetter _
& “, then Log Out and Log back in.”
arrErrDesc(1) = “Unable to map drive ” & DriveLetter & ” to ” & RemotePath _
& ” since ” & DriveLetter & “: was previously reserved by your computer.” _
& vbCrLf & vbCrLf & “(Refer to Management, Shared Folders, Shares)”

‘ Define whether the map information should be removed from the current user’s profile:
bForceRemoveFromProfile = True
bRemoveFromProfile = True

‘ Define whether the map information should be stored in the current user’s profile:
bStoreInProfile = False

‘ Check if already connected:
AlreadyConnected = False
For i = 0 To oDrives.Count – 1 Step 2
If LCase(oDrives.Item(i)) = LCase(DriveLetter) Then AlreadyConnected = True
Next

‘ Attempt to map the drive. If already mapped, first attempt disconnect:
If AlreadyConnected = True then
WshNetwork.RemoveNetworkDrive DriveLetter, bForceRemoveFromProfile, bRemoveFromProfile
If Not strUser = “” Then
WshNetwork.MapNetworkDrive DriveLetter, RemotePath, bStoreInProfile, strUser, strPass
Else
WshNetwork.MapNetworkDrive DriveLetter, RemotePath, bStoreInProfile
End If
‘ If bPopReminder Then WshShell.PopUp “Drive ” & DriveLetter & ” disconnected, then connected successfully to ” & RemotePath
Else
On Error Resume Next
If Not strUser = “” Then
WshNetwork.MapNetworkDrive DriveLetter, RemotePath, bStoreInProfile, strUser, strPass
Else
WshNetwork.MapNetworkDrive DriveLetter, RemotePath, bStoreInProfile
End If
If Err.Number 0 Then
bKnownError = False
For I = LBound(arrErrCode) To UBound(arrErrCode)
If Err.Number = arrErrCode(I) Then
bKnownError = True
strPopMessage = arrErrDesc(I)
‘ Display the Disconnect Network Drives window:
If Err.Number = arrErrCode(0) Then
Set objWSH = Wscript.CreateObject(“WScript.Shell”)
objWSH.Run “rundll32.exe shell32.dll,SHHelpShortcuts_RunDLL Disconnect”, 1, true
End If
Exit For
End If
Next
If Not bKnownError Then
strPopMessage = “Unable to map drive ” & DriveLetter & ” to ” & RemotePath _
& ” due to reason stated below.”
End If
‘ Display warning message:
strPopMessage = “WARNING!! WARNING!! WARNING!! WARNING!!” _
& vbCrLf & vbCrLf & strPopMessage _
& vbCrLf & vbCrLf & Err.Description & ” (error ” & Err.Number & “)” _
& vbCrLf & vbCrLf & strContactMessage
WshShell.PopUp strPopMessage
Else
‘ If bPopReminder Then WshShell.PopUp “Drive ” & DriveLetter & ” connected successfully to ” & RemotePath
End If
End If

wscript.sleep 200
End Sub
======================================================================================================


This script will monitor and count file number in a givven folder . If that count reach the thresold level of 15,
It will popup a message on screen and send an email to specifil email account .For sending email you need to install “bmail” program
for windows and put bmail.exe in c:\
=============================================================================================
@echo off
set _Count=0
for /F “tokens=1,2 delims= ” %%i in (‘dir F:\labvalapp\comms\solar2labval’) do if (%%j)==(File(s)) set _Count=%%i
if (%_Count%)==() goto EXIT
if %_Count% LEQ 15 goto EXIT
echo “Please Check……there is some problem in Auto Validation in MINOS”
cd c:\
bmail -s 10.80.0.50 -t root@gorgon.au.specsavers.com -f monitor@au.specsavers.com -b ” Please check Auto Validation” -a ” Problem in Minos Auto Validation”
pause
:EXIT
set _Count=
=============================================================================================