Re: convert FAT32 to NTFS problem?



this is my last version, anybody can check it for me ? thanks !

Const Fixed = 12
Const ForReading = 1
Set objOFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objOFSO.OpenTextFile("c:\myscript\list.txt",ForReading)
ON Error Resume Next
Do while Not objTextFile.AtEndOfStream
strComputer = objTextFile.ReadLine
Set objWMIService = GetObject("winmgmts://"&strComputer)
set colLogicalDisk = objWMIService.ExecQuery("select * from
Win32_LogicalDisk where MediaType= 12")
For Each objLOgicalDisk In colLogicalDisk
IF UCase(ObjLogicalDisk.FileSystem) = "FAT32" Then
sDiskLetter = obiLogicalDisk.DeviceID
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 = ""
sDiskLable.Put_
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, 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
> > >
> > >
> > >
> > >
.



Relevant Pages

  • Re: What permission(s) am I missing?
    ... of without success. ... > For the most part it doesn't matter which OS you're running the script on, ... > changed the permissions from the defaults on the remote computer. ... >> Administrators group missing and where can I change it? ...
    (microsoft.public.scripting.vbscript)
  • Re: EvfMgr C: -commit followed by Power Down gives lost changes
    ... > a little utility on this PC is started from a remote computer. ... > a script and connects to an external WebServer to fetch the new software. ... > This might include running a script that modifies Registry, deletes files, ... ... They turn off the power. ...
    (microsoft.public.windowsxp.embedded)
  • Re: obshell.run hangs (2)
    ... >>>main script runs a loop that just launches each sub process at a certain ... The SUBscript is being launched ... > from the MAINscript which is in a continuous loop firing off the ... MAINscript to wait for each one to complete before launching a different ...
    (microsoft.public.scripting.wsh)
  • Re: Script Needed
    ... One thought is to have the worker script (the script that runs on the remote computer) save a text file on the desktop. ... I already tried WMI and the processes it runs remotely also are not visible to any users that happen to be logged on. ... messaging service to be turned on, and will not pay for a 3rd party app. ...
    (microsoft.public.scripting.vbscript)
  • Re: Checking for running process
    ... > I've created a simple WSH script for the Win2000 computers in my kid's ... classroom that attempts to solve the problem of the kids launching multiple ... get impatient and click multiple times and launch the app a bunch of times. ... its own PID. ...
    (microsoft.public.scripting.wsh)