roopeman
Mon Nov 07 01:58:04 CST 2005
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@discussions.microsoft.com> wrote in message
> > > news:8109585A-A94E-4A3F-B691-5DBBC6092944@microsoft.com...
> > > >> 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
> > >
> > >
> > >
> > >