/bundles/itninjaweb/img/Breadcrumb_cap_w.png
i need to output this to file please assist

many thanks


strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Environment")

For Each objItem in colItems
Wscript.Echo "Description: " & objItem.Description
Wscript.Echo "Name: " & objItem.Name
Wscript.Echo "System Variable: " & objItem.SystemVariable
Wscript.Echo "User Name: " & objItem.UserName
Wscript.Echo "Variable Value: " & objItem.VariableValue
Next
0 Comments   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

0
Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Const OutputFile = "C:\Temp\output.txt"

Set oFSO = CreateObject("Scripting.FileSystemObject")
Set txt = oFSO.OpenTextFile(OutputFile, ForWriting, True)

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * from Win32_Environment")

For Each objItem in colItems
txt.Writeline "Description: " & objItem.Description
txt.Writeline "Name: " & objItem.Name
txt.Writeline "System Variable: " & objItem.SystemVariable
txt.Writeline "User Name: " & objItem.UserName
txt.Writeline "Variable Value: " & objItem.VariableValue
Next

txt.Close
Answered 11/16/2006 by: spartacus
Black Belt

Please log in to comment
0
hey Spartucus need your assistance again, i need to output the contents of C:\Lotus\Notes\data directory and only need the nsf,ndk and id files

please assist a script you can do would be useful
Answered 11/17/2006 by: rudi
Yellow Belt

Please log in to comment
0
This should hopefully get you started :

Const FolderToSearch = "C:\Lotus\Notes\data"
Const OutputFile = "C:\Temp\results.txt"

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8

Dim oFSO
Dim oFolder,oFiles
Dim text,ext

'Instantiate the FileSystem Object
set oFSO = CreateObject("Scripting.FileSystemObject")

' Check if folder to be searched exists at all and, if not exit gracefully

if oFSO.FolderExists(FolderToSearch) then

' Search Folder was found, so open the report file
Set txt = oFSO.OpenTextFile(OutputFile, ForWriting, True)

set oFolder = OFSO.GetFolder(FolderToSearch)

' Get collection of all the files in the folder to be searched
set oFiles = ofolder.Files

for each file in oFiles
' Get hold of the file extension and, if one of the ones we are looking for, log the filename to the report file
ext = oFSO.GetExtensionName(file.name)
ext = ucase(ext)
if ext = "NSF" OR ext = "NDK" OR ext = "ID" then
txt.writeline file.name
end if
next
txt.close
end if

set oFSO = Nothing


Regards,

Spartacus
Answered 11/17/2006 by: spartacus
Black Belt

Please log in to comment