blkpawns Posted August 8, 2005 Share Posted August 8, 2005 I'am now to VBS scripting and need a little. A trying to figure of how to pull back what domain a machine is currently on using VBS. I know how to pull back which domain the script ran but that is not what I need. I need to I dentify what domain the machine belongs to then execute another process based on that.Thank in advance Link to comment Share on other sites More sharing options...
gunsmokingman Posted August 8, 2005 Share Posted August 8, 2005 Sounds like you need to use WMI Here is a link to The Hey, Scripting Guy! they may have a script that may do what you want. Link to comment Share on other sites More sharing options...
blkpawns Posted August 9, 2005 Author Share Posted August 9, 2005 That would work, but the information is not showing up in WMI. Link to comment Share on other sites More sharing options...
gunsmokingman Posted August 9, 2005 Share Posted August 9, 2005 (edited) That would work, but the information is not showing up in WMI.<{POST_SNAPBACK}>You can have it output messages if you want. You just have to place them in the right spot. Here is a vbs script that you type in the extentionto list all the files with that extention. It uses the WMI to search all localhard drives. It produces a report of the all files with the extention andthere location.Dim Act : Set Act = CreateObject("Wscript.shell")Sd = Act.ExpandEnvironmentStrings("%systemdrive%")Ftype = InputBox("Type In The File Extention Of The The file Type That You Want To Search For" & vbCrlf & vbCrlf & "This Can Take A Few Minutes To Complete, The Time It Take To Complete Depends, On How Large The Drives Are And How Many Files There Are Of The Type You Input." & vbCrlf & VbCrlf & "Example = BMP or bmp" & space(3) & "DLL or dll" & space(3) & "EXE or exe" & Vbcrlf & "No Period Is Needed For The Extentions","Gsm List File Type")strComputer = "."Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")Set colFiles = objWMIService.ExecQuery _ ("Select * from CIM_DataFile Where Extension = '" & Ftype & "'")If colFiles.Count = 0 Then Act.popup "There Was No File Found With That extention", 5, "No File Found", 0 + 64 Wscript.QuitEnd IfSet objFSO = CreateObject("Scripting.FileSystemObject")Set objTextFile = objFSO.CreateTextFile(Sd & "\" & Ftype & ".txt")For Each objFile in colFiles objTextFile.Write("-----------------------------------------" & vbCrlf & objFile.Drive & objFile.Path) objTextFile.Write(objFile.FileName & "." & objFile.Extension & vbCrLf & "File Size=") objTextFile.Write(objFile.FileSize & vbCrLf & "-----------------------------------------" & vbCrlf)NextobjTextFile.CloseAct.Popup "Completed The Script", 4, "List All The " & Ftype, 0 + 32Act.run (SD & "\" & Ftype & ".txt"),1,TrueA1 = Act.Popup("Would You Like To Keep The File" & vbCrLf & "Would You Like To Delete The File" & vbCrLf & "Yes To Keep The File" & vbCrLf & "No To Delete The file" & vbCrLf & "Defualt Time Out Action Is To Keep The File", 7, "Keep Or Delete", 4 + 32)If A1 = 6 ThenAct.popup "Keeping The File" & vbCrLf & Ftype & ".txt", 4, "User Save" & Space(5) & Ftype & ".txt", 0 +32End IfIf A1 = 7 ThenCreateObject("Scripting.FileSystemObject").deletefile(Sd & "\" & Ftype & ".txt")Act.popup "User Selected To Delete The File" & vbCrLf & Sd & "\" & Ftype & ".txt", 4, "User Deleted" & Space(5) & Ftype & ".txt", 0 +32end IfIf A1 = -1 ThenAct.popup "Time Out Occur Performing The Defualt Action" & vbCrlf & "Keeping The " & Sd & "\" & Ftype & ".txt", 4, "Keeping" & Space(5) & Ftype & ".txt", 0 +32End IfOn Error resume NextCreateObject("Scripting.FileSystemObject").deletefile(Sd & "\ListFile.vbs") Edited August 10, 2005 by gunsmokingman Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now