Re: convert FAT32 to NTFS problem?
- From: "roopeman" <roopeman@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 5 Nov 2005 02:48:02 -0800
Hi, Marty List, i modified my script as below, pls. check it for me, thanks !
************************************************************
Const Fixed = 12
Const ForReading = 1
Set objOFSO = CreateObject("Scripting.FileSystemObject")
'Set oShell = Wscript.CreateObject("WScript.Shell")
Set objTextFile = objOFSO.OpenTextFile("c:\myscript\list.txt",ForReading)
'sFile = objOFSO.GetSpecialFolder(2).ShortPath & "\" & objOFSO.GetTempName
ON Error Resume Next
Do while Not objTextFile.AtEndOfStream
strComputer = objTextFile.ReadLine
Set objWMIService = GetObject("winmgmts://"&strComputer)
'Set colLogicalDisk = objWMIService.Instancesof("win32_LogicalDisk")
set colLogicalDisk = objWMIService.ExecQuery("select * from
Win32_LogicalDisk where MediaType= 12")
For Each objLOgicalDisk In colLogicalDisk
IF UCase(ObjLogicalDisk.FileSystem) = "FAT32" Then
sDiskLetter = obiLogicalDisk.DiskID
sDiskLabel = objLOgicalDisk.VolumeName
If sDiskLabel = "" Then
set objWMIService2 = GetObject("winmgmts:\\"&strComputer&
"\root\cimv2:win32_process")
objWMIservice.Create("cmd.exe /c
convert.exe"&sDiskLetter&":/fs:ntfs")
set objWMIService2 = NOthing
Else
sDiskLable = Null
set objWMIService2 = GetObject("winmgmts:\\"&strComputer&
"\root\cimv2:win32_process")
objWMIservice.Create("cmd.exe /c
convert.exe"&sDiskLetter&":/fs:ntfs")
End If
End If
Next
Loop
************************************************************
"roopeman" wrote:
> Hi,Marty List, you mean as below,it 's not work also, and i can not found
> more info. about Win32_process.create in MSDN,can you help me !?
>
> strComputer = "host001"
> Set objWMIService = GetObject _
> ("winmgmts:\\" & strComputer & "\root\cimv2:Win32_Process")
>
> Error = objWMIService.Create("c:\windows\system32\convert.exe d:/FS:NTFS",
> null, null, intProcessID)
>
> If Error = 0 Then
> Wscript.Echo "Notepad was started with a process ID of " _
> & intProcessID & "."
> Else
> Wscript.Echo "Notepad could not be started due to error " & _
> Error & "."
> End If
>
> "Marty List" wrote:
>
> >
> > "roopeman" <roopeman@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
> > news:8109585A-A94E-4A3F-B691-5DBBC6092944@xxxxxxxxxxxxxxxx
> > >> Hi, Dear all, i wrote below script, i want to convert remote host
> > >> Harddisk
> > >> format from FAT32 to NTFS, it 's failed in remote hosts, but succeed in
> > >> local host. would you please check it for me ? with many thanks !
> >
> > Your script is always launching convert.exe on the local machine. The
> > script connects to the remote computer using WMI, and gets the drives of the
> > remote computer, but launches convert.exe onthe local system, with the
> > remote systems's drive letter.
> >
> > Your script uses oShell.Run to launch convert.exe, but look at where oShell
> > comes from:
> > Set oShell = Wscript.CreateObject("WScript.Shell")
> > So when you call the .Run method, how is it suppose to know you want it
> > launched on the remote system?
> >
> > Try WMI's Win32_Process.Create method, which can be used against a remote
> > system:
> > http://msdn.microsoft.com/library/en-us/wmisdk/wmi/win32_process.asp
> > http://msdn.microsoft.com/library/en-us/wmisdk/wmi/create_method_in_class_win32_process.asp
> >
> >
> >
> >
.
- Follow-Ups:
- Re: convert FAT32 to NTFS problem?
- From: roopeman
- Re: convert FAT32 to NTFS problem?
- References:
- Re: convert FAT32 to NTFS problem?
- From: Marty List
- Re: convert FAT32 to NTFS problem?
- Prev by Date: Re: Copy files
- Next by Date: Re: Script Question
- Previous by thread: Re: convert FAT32 to NTFS problem?
- Next by thread: Re: convert FAT32 to NTFS problem?
- Index(es):
Relevant Pages
|