Putting It All Together: Your First WMI/ADSI Script

Size: px
Start display at page:

Download "Putting It All Together: Your First WMI/ADSI Script"

Transcription

1 jones.book Page 351 Wednesday, February 25, :11 PM CHAPTER 20 Putting It All Together: Your First WMI/ADSI Script IN THIS CHAPTER It s time to leverage what you ve learned about ADSI and WMI scripting. In this chapter, I ll walk you through the entire design and creation process for a new script. In addition to demonstrating a useful new purpose for WMI and ADSI, this chapter will help strengthen your script design skills. By now, you should have a good idea of what WMI and ADSI can do for you. In this chapter, I ll walk you through the complete design process for an entirely new script. This time, I ll use both WMI and ADSI in the same script. The script s job will be to check in on every computer in an Active Directory or NT domain and query some information about its operating systems. I want the script to output this information to a text file on a file server. The information I want to collect includes operating system version, service pack level, number of processors in the machine, maximum physical memory in the machine, and so forth. This is a useful way to quickly inventory a network and see what machines might need to be upgraded before deploying a new application, or to see what machines don t have the latest service pack applied. Designing the Script My script is a reasonably complex undertaking, so it helps to break it down into manageable tasks. I need the script to do three things: 1. Query a list of computers from the domain. 2. Query information from each computer. 3. Write information out to a text file. 351

2 jones.book Page 352 Wednesday, February 25, :11 PM 352 Chapter 20 Putting It All Together: Your First WMI/ADSI Script The last bit is probably the easiest. I can use the FileSystemObject to open a text file, write information to it, and then close the text file. Something like the following would work. Dim ofso, ofile Set ofso = CreateObject("Scripting.FileSystemObject") Set ofile = ofso.createtextfile("output.txt") ofile.write "Information" ofile.close For more information on using the FileSystemObject, refer to Chapter 12. Querying a list of computers from the domain shouldn t be too hard, either. If I want the script to work with both NT and Active Directory domains, I need to use the WinNT ADSI provider, because only that provider works with both domains. I can query all of the objects in the domain, and then use an If Then construct to work with only the computer objects. Code such as the following should do the trick. Dim odomain Set odomain = GetObject("WinNT://" & sdomain) Dim oobject, scomputername, sdetails For Each oobject In odomain 'is this object a computer? If oobject.class = "Computer" Then 'yes do something with it End If Next For more information on querying domains by using ADSI, see Chapter 14, and see Querying Domain Information in Chapter 15. Pulling the operating system (OS) information is tougher. WMI seems like the way to go, but WMI has about three gazillion classes. Which one do I need? Fortunately, I have a way to cheat. My primary script editor is Sapien Technology s PrimalScript 3.0, and it includes a WMI Script Wizard.

3 jones.book Page 353 Wednesday, February 25, :11 PM Designing the Script 353 NOTE A trial version of PrimalScript 3.0 is included on the CD that accompanies this book. Running the wizard displays the dialog box shown in Figure The left side of the dialog box shows a list of every WMI class that my computer knows about. Scrolling through the list, I find that there s a class named Win32_OperatingSystem. That seems like a good place to start. Clicking the Win32_OperatingSystem class changes the dialog box to look like the one shown in Figure Here, the wizard has filled in a sample script capable of querying information from the selected class. I see things like service pack level and operating system version, so this is probably the class I want. The wizard offers an Insert button to immediately insert this code into my script, and a Copy button to copy the code to the clipboard. Listing 20.1 shows the complete wizard code. NOTE I ve added line breaks and line continuation characters (_) to Listing 20.1 so that it will fit in this book. Figure 20.1 The WMI Wizard starts with a list of all available WMI classes.

4 jones.book Page 354 Wednesday, February 25, :11 PM 354 Chapter 20 Putting It All Together: Your First WMI/ADSI Script Figure 20.2 The wizard generates sample code to query the selected class. Listing 20.1 WizardCode.vbs. This code queries the Win32_OperatingSystem class and outputs all of the class attributes and their values. On Error Resume Next Dim strcomputer Dim objwmiservice Dim colitems strcomputer = "." Set objwmiservice = GetObject("winmgmts:\\" & _ strcomputer & "\root\cimv2") Set colitems = objwmiservice.execquery( _ "Select * from Win32_OperatingSystem",,48) For Each objitem in colitems WScript.Echo "BootDevice: " & objitem.bootdevice WScript.Echo "BuildNumber: " & objitem.buildnumber WScript.Echo "BuildType: " & objitem.buildtype WScript.Echo "Caption: " & objitem.caption WScript.Echo "CodeSet: " & objitem.codeset WScript.Echo "CountryCode: " & objitem.countrycode WScript.Echo "CreationClassName: " & objitem.creationclassname WScript.Echo "CSCreationClassName: " & _ objitem.cscreationclassname WScript.Echo "CSDVersion: " & objitem.csdversion

5 jones.book Page 355 Wednesday, February 25, :11 PM Designing the Script 355 WScript.Echo "CSName: " & objitem.csname WScript.Echo "CurrentTimeZone: " & objitem.currenttimezone WScript.Echo "Debug: " & objitem.debug WScript.Echo "Description: " & objitem.description WScript.Echo "Distributed: " & objitem.distributed WScript.Echo "EncryptionLevel: " & objitem.encryptionlevel WScript.Echo "ForegroundApplicationBoost: " & _ objitem.foregroundapplicationboost WScript.Echo "FreePhysicalMemory: " & _ objitem.freephysicalmemory WScript.Echo "FreeSpaceInPagingFiles: " & _ objitem.freespaceinpagingfiles WScript.Echo "FreeVirtualMemory: " & objitem.freevirtualmemory WScript.Echo "InstallDate: " & objitem.installdate WScript.Echo "LargeSystemCache: " & objitem.largesystemcache WScript.Echo "LastBootUpTime: " & objitem.lastbootuptime WScript.Echo "LocalDateTime: " & objitem.localdatetime WScript.Echo "Locale: " & objitem.locale WScript.Echo "Manufacturer: " & objitem.manufacturer WScript.Echo "MaxNumberOfProcesses: " & objitem.maxnumberofprocesses WScript.Echo "MaxProcessMemorySize: " & objitem.maxprocessmemorysize WScript.Echo "Name: " & objitem.name WScript.Echo "NumberOfLicensedUsers: " & objitem.numberoflicensedusers WScript.Echo "NumberOfProcesses: " & objitem.numberofprocesses WScript.Echo "NumberOfUsers: " & objitem.numberofusers WScript.Echo "Organization: " & objitem.organization WScript.Echo "OSLanguage: " & objitem.oslanguage WScript.Echo "OSProductSuite: " & objitem.osproductsuite WScript.Echo "OSType: " & objitem.ostype WScript.Echo "OtherTypeDescription: " & objitem.othertypedescription WScript.Echo "PlusProductID: " & objitem.plusproductid WScript.Echo "PlusVersionNumber: " & objitem.plusversionnumber WScript.Echo "Primary: " & objitem.primary WScript.Echo "ProductType: " & objitem.producttype WScript.Echo "QuantumLength: " & objitem.quantumlength WScript.Echo "QuantumType: " & objitem.quantumtype WScript.Echo "RegisteredUser: " & objitem.registereduser WScript.Echo "SerialNumber: " & objitem.serialnumber WScript.Echo "ServicePackMajorVersion: " & _ continues

6 jones.book Page 356 Wednesday, February 25, :11 PM 356 Chapter 20 Putting It All Together: Your First WMI/ADSI Script objitem.servicepackmajorversion WScript.Echo "ServicePackMinorVersion: " & _ objitem.servicepackminorversion WScript.Echo "SizeStoredInPagingFiles: " & _ objitem.sizestoredinpagingfiles WScript.Echo "Status: " & objitem.status WScript.Echo "SuiteMask: " & objitem.suitemask WScript.Echo "SystemDevice: " & objitem.systemdevice WScript.Echo "SystemDirectory: " & objitem.systemdirectory WScript.Echo "SystemDrive: " & objitem.systemdrive WScript.Echo "TotalSwapSpaceSize: " & _ objitem.totalswapspacesize WScript.Echo "TotalVirtualMemorySize: " & _ objitem.totalvirtualmemorysize WScript.Echo "TotalVisibleMemorySize: " & _ objitem.totalvisiblememorysize WScript.Echo "Version: " & objitem.version WScript.Echo "WindowsDirectory: " & objitem.windowsdirectory Next The wizard s code pulls more information than I want, and it s displaying the information in message boxes, rather than writing them to a file, but the code makes a great place to start. I can easily modify it to meet my needs. The script is designed! I identified the three major tasks that the script needs to be able to complete, and I ve created some prototype code that can be adapted to the script s exact requirements. In short, I now know how to do everything I need; I just need to rearrange it and customize it. What, No Wizard? If you re not using PrimalScript, there are some other tools you can use to make WMI scripting easier. In Chapter 18, for example, I introduced Microsoft s Scriptomatic tool, which performs a similar function to the PrimalScript WMI Wizard. You can also dive into the WMI documentation in the MSDN Library ( library), which documents each WMI class and includes some scripting examples.

7 jones.book Page 357 Wednesday, February 25, :11 PM Writing Functions and Subroutines 357 Writing Functions and Subroutines The one bit of functionality that seems to be standalone is the code generated by the wizard, which will do my WMI querying for me. I may need to use that code in another script someday, and I ll definitely be using it over and over in the script I m writing now, so it makes sense to write it as a function. I want the function to accept a computer name, query that computer for specific operating system information, and then compile all that information into a neatly formatted string. The function should return the string to the main script, which can then write it to a file or whatever. Adapting the wizard s code isn t too difficult. Listing 20.2 shows my new GetOSIno() function. Note that this isn t intended to be run as a standalone script; as a function, it must be called by another script, which must provide the name of the computer to connect to as the function s input parameter. Listing 20.2 GetOSInfo.vbs. This function queries a computer s operating system information and returns the results in a string. Function GetOSInfo(sComputer) 'declare variables Dim objwmiservice Dim colitems Dim stroutput 'get WMI service Set objwmiservice = GetObject("winmgmts:\\" & _ strcomputer & "\root\cimv2") 'get item collection Set colitems = objwmiservice.execquery( _ "Select * from Win32_OperatingSystem",,48) 'init output string soutput = String(70,"-") soutput = soutput & scomputer 'append info to output string For Each objitem in colitems continues

8 jones.book Page 358 Wednesday, February 25, :11 PM 358 Chapter 20 Putting It All Together: Your First WMI/ADSI Script stroutput = stroutput & "BuildNumber: " & _ objitem.buildnumber & vbcrlf stroutput = stroutput & "BuildType: " & _ objitem.buildtype & vbcrlf stroutput = stroutput & "Caption: " & _ objitem.caption & vbcrlf stroutput = stroutput & "EncryptionLevel: " & _ objitem.encryptionlevel & vbcrlf stroutput = stroutput & "InstallDate: " & _ objitem.installdate & vbcrlf stroutput = stroutput & "Manufacturer: " & _ objitem.manufacturer & vbcrlf stroutput = stroutput & "MaxNumberOfProcesses: " & _ objitem.maxnumberofprocesses & vbcrlf stroutput = stroutput & "MaxProcessMemorySize: " & _ objitem.maxprocessmemorysize & vbcrlf stroutput = stroutput & "Name: " & _ objitem.name & vbcrlf stroutput = stroutput & _ "NumberOfLicensedUsers: " & _ objitem.numberoflicensedusers & vbcrlf stroutput = stroutput & "NumberOfProcesses: " & _ objitem.numberofprocesses & vbcrlf stroutput = stroutput & "NumberOfUsers: " & _ objitem.numberofusers & vbcrlf stroutput = stroutput & "OSProductSuite: " & _ objitem.osproductsuite & vbcrlf stroutput = stroutput & "OSType: " & _ objitem.ostype & vbcrlf stroutput = stroutput & "OtherTypeDescription: " & _ objitem.othertypedescription & vbcrlf stroutput = stroutput & "Primary: " & _ objitem.primary & vbcrlf stroutput = stroutput & "ProductType: " & _ objitem.producttype & vbcrlf stroutput = stroutput & "RegisteredUser: " & _ objitem.registereduser & vbcrlf stroutput = stroutput & "SerialNumber: " & _ objitem.serialnumber & vbcrlf stroutput = stroutput & _ "ServicePackMajorVersion: " & _ objitem.servicepackmajorversion & vbcrlf stroutput = stroutput & _ "ServicePackMinorVersion: " & _

9 jones.book Page 359 Wednesday, February 25, :11 PM Writing Functions and Subroutines 359 Next objitem.servicepackminorversion & vbcrlf stroutput = stroutput & "Version: " & _ objitem.version & vbcrlf stroutput = stroutput & "WindowsDirectory: " & _ objitem.windowsdirectory & vbcrlf 'return results GetOSInfo = soutput End Function I didn t have to do much to adapt the script. First, I deleted all the lines that I didn t want in my script. I changed all the WScript.Echo commands to stroutput = stroutput &, which appends the information into a string rather than displays it in a message box. I also added & vbcrlf to the end of each line, which adds a carriage return and linefeed character. Those help keep the final output file looking nice. I also dressed up the code at the beginning of the function. 'declare variables Dim objwmiservice Dim colitems Dim stroutput 'get WMI service Set objwmiservice = GetObject("winmgmts:\\" & _ strcomputer & "\root\cimv2") 'get item collection Set colitems = objwmiservice.execquery( _ "Select * from Win32_OperatingSystem",,48) 'init output string soutput = String(70,"-") soutput = soutput & scomputer I added some comments to document the code PrimalScript isn t so good about that and I initialized my soutput variable. I also started soutput off to contain a line of 70 hyphens, and the name of the computer I m

10 jones.book Page 360 Wednesday, February 25, :11 PM 360 Chapter 20 Putting It All Together: Your First WMI/ADSI Script querying. These extra touches help make the final output file easier to read and more useful. Writing the Main Script The function was probably the toughest part to write; with that out of the way, I can adapt my prototype code to create the main script, shown in Listing Listing 20.3 MainScript.vbs. Queries the domain, creates the output file, and calls the custom function I already wrote. Dim sdomain sdomain = InputBox("Enter domain to inventory") 'connect to domain and retrieve 'a list of member objects Dim odomain Set odomain = GetObject("WinNT://" & sdomain) 'get the filesystemobject Dim ofso Set ofso = CreateObject("Scripting.FileSystemObject") 'open an output file Dim ooutput Set ooutput = ofso.createtextfile("\\server1\public\output.txt") 'run through the objects Dim oobject, scomputername, sdetails For Each oobject In odomain 'is this object a computer? If oobject.class = "Computer" Then 'yes - get computer name scomputername = oobject.name 'get OS info sdetails = GetOSInfo(sComputerName)

11 jones.book Page 361 Wednesday, February 25, :11 PM Writing the Main Script 361 'write info to the file ooutput.write sdetails End If Next 'close the output file ooutput.close 'release objects Set ooutput = Nothing Set ofso = Nothing Set oobject = nothing Set odomain = Nothing 'display completion message WScript.Echo "Output saved to \\server1\public\output.txt" I ll provide my usual walk-through of this script in a bit; for now, try to pick out the adapted pieces of prototype code. Notice where I m querying the domain, opening and writing to the text file, closing the text file, and calling the GetOSInfo() function. Inventorying the Domain Listing 20.4 shows the complete, ready-to-run script. Get this ready to run, but don t execute it just yet. In the next section, I ll cover testing and troubleshooting this script. Listing 20.4 InventoryDomain.vbs. The complete domain inventory script. 'get domain name Dim sdomain sdomain = InputBox("Enter domain to inventory") 'connect to domain and retrieve 'a list of member objects Dim odomain Set odomain = GetObject("WinNT://" & sdomain 'get the filesystemobject continues

12 jones.book Page 362 Wednesday, February 25, :11 PM 362 Chapter 20 Putting It All Together: Your First WMI/ADSI Script Dim ofso Set ofso = CreateObject("Scripting.FileSystemObject") 'open an output file Dim ooutput ooutput = ofso.createtextfile("\\server1\public\output.txt") 'run through the objects Dim oobject, scomputername, sdetails For Each oobject In odomain 'is this object a computer? If oobject.class = "Computer" Then 'yes - get computer name scomputername = oobject.name 'get OS info sdetails = GetOSInfo(sComputerName) 'write info to the file ooutput.write sdetails End If Next 'close the output file ooutput.close 'release objects Set ooutput = Nothing Set ofso = Nothing Set oobject = nothing Set odomain = Nothing 'display completion message WScript.Echo "Output saved to \\server1\public\output.txt" Function GetOSInfo(sComputer) 'declare variables Dim objwmiservice Dim colitems Dim stroutput

13 jones.book Page 363 Wednesday, February 25, :11 PM Writing the Main Script 363 'get WMI service Set objwmiservice = GetObject("winmgmts:\\" & _ strcomputer & "\root\cimv2") 'get item collection Set colitems = objwmiservice.execquery( _ "Select * from Win32_OperatingSystem",,48) 'init output string soutput = String(70,"-") soutput = soutput & scomputer 'append info to output string For Each objitem in colitems stroutput = stroutput & "BuildNumber: " & _ objitem.buildnumber & vbcrlf stroutput = stroutput & "BuildType: " & _ objitem.buildtype & vbcrlf stroutput = stroutput & "Caption: " & _ objitem.caption & vbcrlf stroutput = stroutput & "EncryptionLevel: " & _ objitem.encryptionlevel & vbcrlf stroutput = stroutput & "InstallDate: " & _ objitem.installdate & vbcrlf stroutput = stroutput & "Manufacturer: " & _ objitem.manufacturer & vbcrlf stroutput = stroutput & "MaxNumberOfProcesses: " & _ objitem.maxnumberofprocesses & vbcrlf stroutput = stroutput & "MaxProcessMemorySize: " & _ objitem.maxprocessmemorysize & vbcrlf stroutput = stroutput & "Name: " & _ objitem.name & vbcrlf stroutput = stroutput & _ "NumberOfLicensedUsers: " & _ objitem.numberoflicensedusers & vbcrlf stroutput = stroutput & "NumberOfProcesses: " & _ objitem.numberofprocesses & vbcrlf stroutput = stroutput & "NumberOfUsers: " & _ objitem.numberofusers & vbcrlf stroutput = stroutput & "OSProductSuite: " & _ objitem.osproductsuite & vbcrlf stroutput = stroutput & "OSType: " & _ objitem.ostype & vbcrlf continues

14 jones.book Page 364 Wednesday, February 25, :11 PM 364 Chapter 20 Putting It All Together: Your First WMI/ADSI Script Next stroutput = stroutput & "OtherTypeDescription: " & _ objitem.othertypedescription & vbcrlf stroutput = stroutput & "Primary: " & _ objitem.primary & vbcrlf stroutput = stroutput & "ProductType: " & _ objitem.producttype & vbcrlf stroutput = stroutput & "RegisteredUser: " & _ objitem.registereduser & vbcrlf stroutput = stroutput & "SerialNumber: " & _ objitem.serialnumber & vbcrlf stroutput = stroutput & _ "ServicePackMajorVersion: " & _ objitem.servicepackmajorversion & vbcrlf stroutput = stroutput & _ "ServicePackMinorVersion: " & _ objitem.servicepackminorversion & vbcrlf stroutput = stroutput & "Version: " & _ objitem.version & vbcrlf stroutput = stroutput & "WindowsDirectory: " & _ objitem.windowsdirectory & vbcrlf 'return results GetOSInfo = soutput End Function You need to change where this script puts its output file before using it in your environment. The script prompts for the domain name, so you won t have to make any changes there. Inventorying the Domain Explained The script starts by prompting for the domain name. This allows the script to be used in a multidomain environment. The domain name is stored in a string variable. 'get domain name Dim sdomain sdomain = InputBox("Enter domain to inventory")

15 jones.book Page 365 Wednesday, February 25, :11 PM Writing the Main Script 365 Next, the script uses ADSI to connect to the domain and retrieve a list of all domain objects. This may be a lengthy operation in a large domain, because computer, user, and all other objects are included in the results. 'connect to domain and retrieve 'a list of member objects Dim odomain Set odomain = GetObject("WinNT://" & sdomain The script creates a new FileSystemObject and assigns it to a variable. 'get the filesystemobject Dim ofso Set ofso = CreateObject("Scripting.FileSystemObject") The script now creates a new text file by using the FileSystemObject s CreateTextFile method. The method returns a TextStream object, which is assigned to the variable ooutput. 'open an output file Dim ooutput ooutput = ofso.createtextfile("\\server1\public\output.txt") odomain now represents all of the objects in the domain; I ll use a For Each Next loop to iterate through each object in turn. Within the loop, oobject will represent the current object. 'run through the objects Dim oobject, scomputername, sdetails For Each oobject In odomain Because odomain contains more than just computers, I need to check each object to see if its Class property equals Computer. That way, I can just work with the computer objects and skip the rest. 'is this object a computer? If oobject.class = "Computer" Then For objects that are a computer, I pull the computer name into a variable. Then, I assign the results of GetOSInfo() to variable sdetails. Finally, I write sdetails to the output text file using the TextStream object s Write

16 jones.book Page 366 Wednesday, February 25, :11 PM 366 Chapter 20 Putting It All Together: Your First WMI/ADSI Script method. Closing up the loop with Next moves on to the next object in the domain. 'yes - get computer name scomputername = oobject.name 'get OS info sdetails = GetOSInfo(sComputerName) 'write info to the file ooutput.write sdetails End If Next When I m done with all the objects, I close the output file, release all the objects I created by setting them equal to Nothing, and then display a simple completion message. 'close the output file ooutput.close 'release objects Set ooutput = Nothing Set ofso = Nothing Set oobject = nothing Set odomain = Nothing 'display completion message WScript.Echo "Output saved to \\server1\public\output.txt" Here s that function I wrote earlier. It starts with basic variable declaration. Function GetOSInfo(sComputer) 'declare variables Dim objwmiservice Dim colitems Dim stroutput

17 jones.book Page 367 Wednesday, February 25, :11 PM Writing the Main Script 367 Next is pure wizard code, which uses GetObject to connect to the specified computer s WMI service. 'get WMI service Set objwmiservice = GetObject("winmgmts:\\" & _ strcomputer & "\root\cimv2") After I am connected, I execute a query to retrieve the Win32_OperatingSystem class. 'get item collection Set colitems = objwmiservice.execquery( _ "Select * from Win32_OperatingSystem",,48) I set up my output string to include a line of hyphens and the current computer name. 'init output string soutput = String(70,"-") soutput = soutput & scomputer Finally, I append the WMI information to the output string. 'append info to output string For Each objitem in colitems stroutput = stroutput & "BuildNumber: " & _ objitem.buildnumber & vbcrlf stroutput = stroutput & "BuildType: " & _ objitem.buildtype & vbcrlf stroutput = stroutput & "Caption: " & _ objitem.caption & vbcrlf stroutput = stroutput & "EncryptionLevel: " & _ objitem.encryptionlevel & vbcrlf stroutput = stroutput & "InstallDate: " & _ objitem.installdate & vbcrlf stroutput = stroutput & "Manufacturer: " & _ objitem.manufacturer & vbcrlf stroutput = stroutput & "MaxNumberOfProcesses: " & _ objitem.maxnumberofprocesses & vbcrlf stroutput = stroutput & "MaxProcessMemorySize: " & _ objitem.maxprocessmemorysize & vbcrlf continues

18 jones.book Page 368 Wednesday, February 25, :11 PM 368 Chapter 20 Putting It All Together: Your First WMI/ADSI Script stroutput = stroutput & "Name: " & _ objitem.name & vbcrlf stroutput = stroutput & _ "NumberOfLicensedUsers: " & _ objitem.numberoflicensedusers & vbcrlf stroutput = stroutput & "NumberOfProcesses: " & _ objitem.numberofprocesses & vbcrlf stroutput = stroutput & "NumberOfUsers: " & _ objitem.numberofusers & vbcrlf stroutput = stroutput & "OSProductSuite: " & _ objitem.osproductsuite & vbcrlf stroutput = stroutput & "OSType: " & _ objitem.ostype & vbcrlf stroutput = stroutput & "OtherTypeDescription: " & _ objitem.othertypedescription & vbcrlf stroutput = stroutput & "Primary: " & _ objitem.primary & vbcrlf stroutput = stroutput & "ProductType: " & _ objitem.producttype & vbcrlf stroutput = stroutput & "RegisteredUser: " & _ objitem.registereduser & vbcrlf stroutput = stroutput & "SerialNumber: " & _ objitem.serialnumber & vbcrlf stroutput = stroutput & _ "ServicePackMajorVersion: " & _ objitem.servicepackmajorversion & vbcrlf stroutput = stroutput & _ "ServicePackMinorVersion: " & _ objitem.servicepackminorversion & vbcrlf stroutput = stroutput & "Version: " & _ objitem.version & vbcrlf stroutput = stroutput & "WindowsDirectory: " & _ objitem.windowsdirectory & vbcrlf Next With the main script finished, I return the output string as the function s result. 'return results GetOSInfo = soutput End Function

19 jones.book Page 369 Wednesday, February 25, :11 PM Testing the Script 369 There you have it a nice, easy-to-use administrative script that uses both WMI and ADSI to accomplish a useful task. Testing the Script If you jumped ahead and already tried to execute the final script, you realize that it s flawed. If you haven t, go ahead and give it a whirl now. Take a few minutes to see if you can track down the problem. There are actually three errors, and here are some hints. One is a simple typo. One is a sort of logic error, where something isn t being used properly for the situation. The last one is a typo, and could have been avoided if I had followed my own advice from earlier in the book. Can you find them all? The first one is an easy mistake: I simply forgot a closing parentheses. 'connect to domain and retrieve 'a list of member objects Dim odomain Set odomain = GetObject("WinNT://" & sdomain The correct code should be Set odomain = GetObject("WinNT://" & sdomain). The next one s a bit trickier. 'open an output file Dim ooutput ooutput = ofso.createtextfile("\\server1\public\output.txt") Can you see it? I m using ooutput to represent an object, but I forgot to use the Set keyword when making the assignment. VBScript requires Set whenever you re assigning an object to a variable. The corrected code looks like this. 'open an output file Dim ooutput Set ooutput = ofso.createtextfile("\\server1\public\ output.txt")

20 jones.book Page 370 Wednesday, February 25, :11 PM 370 Chapter 20 Putting It All Together: Your First WMI/ADSI Script The last error is tricky, too. It s in the GetOSInfo() function. Function GetOSInfo(sComputer) 'declare variables Dim objwmiservice Dim colitems Dim stroutput 'get WMI service Set objwmiservice = GetObject("winmgmts:\\" & _ strcomputer & "\root\cimv2") Did you find it? The problem is that I used the wizard-generated code, which uses str as a prefix for string variables. I m in the habit of using the shorter prefix s for string variables, and that s where my problem lies. In the function definition, I declared scomputer, but in the line of code that connects to the WMI service, I used strcomputer. I continued using scomputer elsewhere, so strcomputer is wrong. Here s the corrected code snippet. Function GetOSInfo(sComputer) 'declare variables Dim objwmiservice Dim colitems Dim stroutput 'get WMI service Set objwmiservice = GetObject("winmgmts:\\" & _ scomputer & "\root\cimv2") The problem with this error is that it doesn t cause a problem for the script; the script will execute just fine. You just won t get any results, because the script would try to connect to a computer named. I mentioned that I could have avoided this problem by following my own advice. Had I included Option Explicit, VBScript would have produced an error on the offending line of code, because strcomputer wasn t declared. scomputer, on the other hand, is implicitly declared because it s part of a function declaration. You ll notice that I did the same thing with stroutput and soutput, meaning they ll have to be corrected, too.

21 jones.book Page 371 Wednesday, February 25, :11 PM Testing the Script 371 Just to make sure you ve got it all, Listing 20.5 includes the complete, corrected script. Remember that this script is also available on the CD that accompanies this book. Listing 20.5 InventoryDomain2.vbs. This corrected script produces the expected results. 'get domain name Dim sdomain sdomain = InputBox("Enter domain to inventory") 'connect to domain and retrieve 'a list of member objects Dim odomain Set odomain = GetObject("WinNT://" & sdomain) 'get the filesystemobject Dim ofso Set ofso = CreateObject("Scripting.FileSystemObject") 'open an output file Dim ooutput Set ooutput = ofso.createtextfile("\\server1\public\output.txt") 'run through the objects Dim oobject, scomputername, sdetails For Each oobject In odomain 'is this object a computer? If oobject.class = "Computer" Then 'yes - get computer name scomputername = oobject.name 'get OS info sdetails = GetOSInfo(sComputerName) 'write info to the file ooutput.write sdetails End If Next continues

22 jones.book Page 372 Wednesday, February 25, :11 PM 372 Chapter 20 Putting It All Together: Your First WMI/ADSI Script 'close the output file ooutput.close 'release objects Set ooutput = Nothing Set ofso = Nothing Set oobject = nothing Set odomain = Nothing 'display completion message WScript.Echo "Output saved to \\server1\public\output.txt" Function GetOSInfo(sComputer) 'declare variables Dim objwmiservice Dim colitems Dim stroutput 'get WMI service Set objwmiservice = GetObject("winmgmts:\\" & _ scomputer & "\root\cimv2") 'get item collection Set colitems = objwmiservice.execquery( _ "Select * from Win32_OperatingSystem",,48) 'init output string stroutput = String(70,"-") stroutput = stroutput & scomputer 'append info to output string For Each objitem in colitems stroutput = stroutput & "BuildNumber: " & _ objitem.buildnumber & vbcrlf stroutput = stroutput & "BuildType: " & _ objitem.buildtype & vbcrlf stroutput = stroutput & "Caption: " & _ objitem.caption & vbcrlf stroutput = stroutput & "EncryptionLevel: " & _ objitem.encryptionlevel & vbcrlf stroutput = stroutput & "InstallDate: " & _ objitem.installdate & vbcrlf stroutput = stroutput & "Manufacturer: " & _

23 jones.book Page 373 Wednesday, February 25, :11 PM Testing the Script 373 objitem.manufacturer & vbcrlf stroutput = stroutput & "MaxNumberOfProcesses: " & _ objitem.maxnumberofprocesses & vbcrlf stroutput = stroutput & "MaxProcessMemorySize: " & _ objitem.maxprocessmemorysize & vbcrlf stroutput = stroutput & "Name: " & _ objitem.name & vbcrlf stroutput = stroutput & _ "NumberOfLicensedUsers: " & _ objitem.numberoflicensedusers & vbcrlf stroutput = stroutput & "NumberOfProcesses: " & _ objitem.numberofprocesses & vbcrlf stroutput = stroutput & "NumberOfUsers: " & _ objitem.numberofusers & vbcrlf stroutput = stroutput & "OSProductSuite: " & _ objitem.osproductsuite & vbcrlf stroutput = stroutput & "OSType: " & _ objitem.ostype & vbcrlf stroutput = stroutput & "OtherTypeDescription: " & _ objitem.othertypedescription & vbcrlf stroutput = stroutput & "Primary: " & _ objitem.primary & vbcrlf stroutput = stroutput & "ProductType: " & _ objitem.producttype & vbcrlf stroutput = stroutput & "RegisteredUser: " & _ objitem.registereduser & vbcrlf stroutput = stroutput & "SerialNumber: " & _ objitem.serialnumber & vbcrlf stroutput = stroutput & _ "ServicePackMajorVersion: " & _ objitem.servicepackmajorversion & vbcrlf stroutput = stroutput & _ "ServicePackMinorVersion: " & _ objitem.servicepackminorversion & vbcrlf stroutput = stroutput & "Version: " & _ objitem.version & vbcrlf stroutput = stroutput & "WindowsDirectory: " & _ objitem.windowsdirectory & vbcrlf Next 'return results GetOSInfo = soutput End Function

24 jones.book Page 374 Wednesday, February 25, :11 PM 374 Chapter 20 Putting It All Together: Your First WMI/ADSI Script Testing a large script like this is much easier with the Script Debugger. You can spot lines that are causing trouble just by following the execution path. For more information on the Script Debugger, see Testing the Script in Chapter 13. You can also read up on the Script Debugger in the VBScript documentation at Review Pulling together ADSI and WMI into a single script offers some powerful functionality. More importantly, though, the example in this chapter should make you feel more comfortable with the sometimes-daunting task of creating a script from scratch. Just break down the tasks that need to be completed, and then develop some prototype code for each task. Use wizards, examples from the Web, or samples from this book to help create prototype code. After all, there s no sense reinventing the wheel when there s a large library of samples on the Web and in this book to work with! With your task list and prototype out of the way, you can start assembling the script. Write functions and subs to perform repetitive tasks, or tasks that you may want to reuse in future scripts. Write the main script, and then start testing. With this methodology in mind, most scripts can be whipped together quickly! COMING UP Web pages offer an exciting way to create your own centrally located, easily accessible administrative tools. In the next chapter, I ll introduce you to Active Server Pages, and in the following chapters, I ll show you how to easily and quickly apply your scripting skills to create great administrative Web pages.

Putting It All Together: Your First WMI/ADSI Script

Putting It All Together: Your First WMI/ADSI Script CHAPTER 20 Putting It All Together: Your First WMI/ADSI Script IN THIS CHAPTER. Designing the Script. Writing Functions and Subroutines. Writing the Main Script. Testing the Script By now, you should have

More information

Overview. Program Start VB SCRIPT SIGNER. IT Services

Overview. Program Start VB SCRIPT SIGNER. IT Services Overview It is sometimes much easier (and easier to maintain) to use a Visual Basic Script on Windows to perform system functions rather than coding those functions in C++ (WMI is a good example of this).

More information

How to detect the CPU and OS Architecture

How to detect the CPU and OS Architecture How to detect the CPU and OS Architecture The client I am working for now, has both XP and Windows 7. XP is 32 bits and Windows 7 is 64 bits. To avoid that I have to make the packages twice, I make both

More information

This article will walk you through a few examples in which we use ASP to bring java classes together.

This article will walk you through a few examples in which we use ASP to bring java classes together. Using Java classes with ASP ASP is a great language, and you can do an awful lot of really great things with it. However, there are certain things you cannot do with ASP, such as use complex data structures

More information

CS354 gdb Tutorial Written by Chris Feilbach

CS354 gdb Tutorial Written by Chris Feilbach CS354 gdb Tutorial Written by Chris Feilbach Purpose This tutorial aims to show you the basics of using gdb to debug C programs. gdb is the GNU debugger, and is provided on systems that

More information

XP: Backup Your Important Files for Safety

XP: Backup Your Important Files for Safety XP: Backup Your Important Files for Safety X 380 / 1 Protect Your Personal Files Against Accidental Loss with XP s Backup Wizard Your computer contains a great many important files, but when it comes to

More information

C++ CIM Client OpenPegasus. Denise Eckstein Hewlett-Packard

C++ CIM Client OpenPegasus. Denise Eckstein Hewlett-Packard C++ OpenPegasus Denise Eckstein Hewlett-Packard Module Content C++ Client Overview Concept Overview Client Example Client API 2 CIM Operations Terminology A CIM Operation describes a management action

More information

Adevice driver is a tiny chunk of programming code that

Adevice driver is a tiny chunk of programming code that Device Driver Tweaks CHAPTER W1 Adevice driver is a tiny chunk of programming code that serves as a kind of middleman between Windows and a particular device. For example, if Windows needs a device to

More information

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch

CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch CSCI 1100L: Topics in Computing Lab Lab 11: Programming with Scratch Purpose: We will take a look at programming this week using a language called Scratch. Scratch is a programming language that was developed

More information

The name of this chapter is Dealing with Devices, but of

The name of this chapter is Dealing with Devices, but of Dealing with Devices CHAPTER W2 The name of this chapter is Dealing with Devices, but of course we never deal with our devices directly. Instead, we delegate that job to Windows, and it takes care of the

More information

SharePoint 2010 Site Owner s Manual by Yvonne M. Harryman

SharePoint 2010 Site Owner s Manual by Yvonne M. Harryman SharePoint 2010 Site Owner s Manual by Yvonne M. Harryman Chapter 9 Copyright 2012 Manning Publications Brief contents PART 1 GETTING STARTED WITH SHAREPOINT 1 1 Leveraging the power of SharePoint 3 2

More information

Associating Run As Accounts in Operations Manager 2007

Associating Run As Accounts in Operations Manager 2007 Associating Run As Accounts in Operations Manager 2007 A short tutorial on how to associate a Run As Account to a monitor in Operations Manager 2007 Stefan Stranger, MOM MVP http://weblog.stranger.nl December,

More information

Debugging Your Python Code: For Dummies

Debugging Your Python Code: For Dummies Debugging Your Python Code: For Dummies Tyler J. Metivier University of Connecticut Dept. of Physics May 4, 2018 1 What s the problem? It doesn t matter if you ve written 1 script or programmed a space

More information

WBEM Infrastructure Introduction

WBEM Infrastructure Introduction WBEM Infrastructure Introduction Tuesday, June 17, 2003 3:15 PM - 4:05 PM Denise Eckstein Hewlett-Packard Page 1 WBEM Overview Web-Based Enterprise Management (WBEM) is a platform and resource independent

More information

When Microsoft releases new updates to firmware and drivers, the firmware and driver pack is updated for all Surface models.

When Microsoft releases new updates to firmware and drivers, the firmware and driver pack is updated for all Surface models. Managing Surface Devices in the Enterprise Firmware/Driver Management with System Center Configuration Manager 2012 This article describes how to deploy enterprise-managed firmware and drivers to Surface

More information

Taking Advantage of ADSI

Taking Advantage of ADSI Taking Advantage of ADSI Active Directory Service Interfaces (ADSI), is a COM-based set of interfaces that allow you to interact and manipulate directory service interfaces. OK, now in English that means

More information

PrimalScript. Your First 20 Minutes. Your First 20 Minutes. Start here to be productive with PrimalScript in just 20 minutes.

PrimalScript. Your First 20 Minutes. Your First 20 Minutes. Start here to be productive with PrimalScript in just 20 minutes. Your First 20 Minutes Contents Before Installing PrimalScript Install PrimalScript Launch PrimalScript Set Script and Project Folders Create a New Script Insert WMI Code Use PrimalSense Run a Script with

More information

Public Meeting Agenda Formatting Best Practices

Public Meeting Agenda Formatting Best Practices DEFINITIVE GUIDE Public Meeting Agenda Formatting Best Practices In this guide, we will first walk you through some best practices with text and images. Then, we will show you how to execute the best practices

More information

EDGE, MICROSOFT S BROWSER

EDGE, MICROSOFT S BROWSER EDGE, MICROSOFT S BROWSER To launch Microsoft Edge, click the Microsoft Edge button (it s the solid blue E) on the Windows Taskbar. Edge Replaces Internet Explorer Internet Explorer is no longer the default

More information

COPYRIGHTED MATERIAL. Starting Strong with Visual C# 2005 Express Edition

COPYRIGHTED MATERIAL. Starting Strong with Visual C# 2005 Express Edition 1 Starting Strong with Visual C# 2005 Express Edition Okay, so the title of this chapter may be a little over the top. But to be honest, the Visual C# 2005 Express Edition, from now on referred to as C#

More information

Setting up a ColdFusion Workstation

Setting up a ColdFusion Workstation Setting up a ColdFusion Workstation Draft Version Mark Mathis 2000 all rights reserved mark@teratech.com 2 Setting up a ColdFusion workstation Table of Contents Browsers:...5 Internet Explorer:...5 Web

More information

Deploying Dell Open Manage Server Administrator from IT Assistant 7.0

Deploying Dell Open Manage Server Administrator from IT Assistant 7.0 Deploying Dell Open Manage Server Administrator from IT Assistant 7.0 Enterprise Systems Group (ESG) Dell OpenManage Systems Management Dell White Paper By Annapurna Dasari Annapurna_Dasari@dell.com May

More information

Upgrading Applications

Upgrading Applications C0561587x.fm Page 77 Thursday, November 15, 2001 2:37 PM Part II Upgrading Applications 5 Your First Upgrade 79 6 Common Tasks in Visual Basic.NET 101 7 Upgrading Wizard Ins and Outs 117 8 Errors, Warnings,

More information

CS193P: HelloPoly Walkthrough

CS193P: HelloPoly Walkthrough CS193P: HelloPoly Walkthrough Overview The goal of this walkthrough is to give you a fairly step by step path through building a simple Cocoa Touch application. You are encouraged to follow the walkthrough,

More information

Oracle SQL. murach s. and PL/SQL TRAINING & REFERENCE. (Chapter 2)

Oracle SQL. murach s. and PL/SQL TRAINING & REFERENCE. (Chapter 2) TRAINING & REFERENCE murach s Oracle SQL and PL/SQL (Chapter 2) works with all versions through 11g Thanks for reviewing this chapter from Murach s Oracle SQL and PL/SQL. To see the expanded table of contents

More information

CISC-124. Casting. // this would fail because we can t assign a double value to an int // variable

CISC-124. Casting. // this would fail because we can t assign a double value to an int // variable CISC-124 20180122 Today we looked at casting, conditionals and loops. Casting Casting is a simple method for converting one type of number to another, when the original type cannot be simply assigned to

More information

StoryStylus Scripting Help

StoryStylus Scripting Help StoryStylus Scripting Help Version 0.9.6 Monday, June 29, 2015 One More Story Games, Inc. 2015 Contents Versions... 3 Scripting User Interface... 4 Script Triggers... 5 If-Then Scripting Language... 6

More information

Java/RealJ Troubleshooting Guide

Java/RealJ Troubleshooting Guide Java/RealJ Troubleshooting Guide by Bob Clark / Sharon Curtis / Simon Jones, September 2000 Some of these tips you will come across during your practical sessions, however we felt it would be helpful to

More information

Practice CS106B Midterm Solutions

Practice CS106B Midterm Solutions CS106B Handout 16S Winter 2019 February 12, 2019 Practice CS106B Midterm Solutions Here s one possible set of solutions for the midterm questions. Before reading over these solutions, please, please, please

More information

1.7 Limit of a Function

1.7 Limit of a Function 1.7 Limit of a Function We will discuss the following in this section: 1. Limit Notation 2. Finding a it numerically 3. Right and Left Hand Limits 4. Infinite Limits Consider the following graph Notation:

More information

Quick Web Development using JDeveloper 10g

Quick Web Development using JDeveloper 10g Have you ever experienced doing something the long way and then learned about a new shortcut that saved you a lot of time and energy? I can remember this happening in chemistry, calculus and computer science

More information

EchoSub v1.2 EchoStyle

EchoSub v1.2 EchoStyle EchoSub v1.2 EchoStyle 2002-2003 2 I. Introduction These days it s nothing special anymore to watch a movie on your computer. But of course, you also want matching subtitles. These can be gotten from many

More information

Introduction. A Brief Description of Our Journey

Introduction. A Brief Description of Our Journey Introduction If you still write RPG code as you did 20 years ago, or if you have ILE RPG on your resume but don t actually use or understand it, this book is for you. It will help you transition from the

More information

Custom Fields in QuickBooks

Custom Fields in QuickBooks Custom Fields in QuickBooks November 20, 2013 By Charlie Russell 41 Replies Every business has some sort of unique information that is important to its operation. While QuickBooks Desktop provides the

More information

Burning CDs in Windows XP

Burning CDs in Windows XP B 770 / 1 Make CD Burning a Breeze with Windows XP's Built-in Tools If your PC is equipped with a rewritable CD drive you ve almost certainly got some specialised software for copying files to CDs. If

More information

Learn Windows PowerShell in a Month of Lunches

Learn Windows PowerShell in a Month of Lunches Learn Windows PowerShell in a Month of Lunches by Don Jones Chapter 4 Copyright 2011 Manning Publications brief contents 1 Before you begin 1 2 Running commands 9 3 Using the help system 23 4 The pipeline:

More information

Department of Computer Science. Software Usage Guide. CSC132 Programming Principles 2. By Andreas Grondoudis

Department of Computer Science. Software Usage Guide. CSC132 Programming Principles 2. By Andreas Grondoudis Department of Computer Science Software Usage Guide To provide a basic know-how regarding the software to be used for CSC132 Programming Principles 2 By Andreas Grondoudis WHAT SOFTWARE AM I GOING TO NEED/USE?...2

More information

First-Order Translation Checklist

First-Order Translation Checklist CS103 Winter 2019 First-Order Translation Checklist Cynthia Lee Keith Schwarz In this handout, we ve distilled five specific points that you should check in your first-order logic statements before submitting

More information

There are two types of Hardware Inventory configuration changes that you may need to implement in your environment.

There are two types of Hardware Inventory configuration changes that you may need to implement in your environment. Data requirements Taking advantage of the new security features in Windows 10 - and to ultimately assess an organization s readiness -, uses data collected from clients through the standard Configuration

More information

Creating a new form with check boxes, drop-down list boxes, and text box fill-ins. Customizing each of the three form fields.

Creating a new form with check boxes, drop-down list boxes, and text box fill-ins. Customizing each of the three form fields. In This Chapter Creating a new form with check boxes, drop-down list boxes, and text box fill-ins. Customizing each of the three form fields. Adding help text to any field to assist users as they fill

More information

Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website:

Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website: Welcome to Lab! Feel free to get started until we start talking! The lab document is located on the course website: https://users.wpi.edu/~sjarvis/ece2049_smj/ We will come around checking your pre-labs

More information

Outlook is easier to use than you might think; it also does a lot more than. Fundamental Features: How Did You Ever Do without Outlook?

Outlook is easier to use than you might think; it also does a lot more than. Fundamental Features: How Did You Ever Do without Outlook? 04 537598 Ch01.qxd 9/2/03 9:46 AM Page 11 Chapter 1 Fundamental Features: How Did You Ever Do without Outlook? In This Chapter Reading e-mail Answering e-mail Creating new e-mail Entering an appointment

More information

Chapter 1 Introduction

Chapter 1 Introduction Chapter 1 Introduction Why I Am Writing This: Why I am I writing a set of tutorials on compilers and how to build them? Well, the idea goes back several years ago when Rapid-Q, one of the best free BASIC

More information

Debugging Code in Access 2002

Debugging Code in Access 2002 0672321025 AppA 10/24/01 3:53 PM Page 1 Debugging Code in Access 2002 APPENDIX A IN THIS APPENDIX Setting the Correct Module Options for Maximum Debugging Power 2 Using the Immediate Window 6 Stopping

More information

Fundamental C# Programming

Fundamental C# Programming Part 1 Fundamental C# Programming In this section you will find: Chapter 1: Introduction to C# Chapter 2: Basic C# Programming Chapter 3: Expressions and Operators Chapter 4: Decisions, Loops, and Preprocessor

More information

SAMPLE CHAPTER SECOND EDITION. Don Jones Jeffery Hicks Richard Siddaway MANNING

SAMPLE CHAPTER SECOND EDITION. Don Jones Jeffery Hicks Richard Siddaway MANNING SAMPLE CHAPTER SECOND EDITION Don Jones Jeffery Hicks Richard Siddaway MANNING PowerShell in Depth by Don Jones Jeffery Hicks Richard Siddaway Chapter 1 Copyright 2015 Manning Publications brief contents

More information

6.189 Project 1. Readings. What to hand in. Project 1: The Game of Hangman. Get caught up on all the readings from this week!

6.189 Project 1. Readings. What to hand in. Project 1: The Game of Hangman. Get caught up on all the readings from this week! 6.189 Project 1 Readings Get caught up on all the readings from this week! What to hand in Print out your hangman code and turn it in Monday, Jaunary 10 at 2:10 PM. Be sure to write your name and section

More information

CS103 Handout 29 Winter 2018 February 9, 2018 Inductive Proofwriting Checklist

CS103 Handout 29 Winter 2018 February 9, 2018 Inductive Proofwriting Checklist CS103 Handout 29 Winter 2018 February 9, 2018 Inductive Proofwriting Checklist In Handout 28, the Guide to Inductive Proofs, we outlined a number of specifc issues and concepts to be mindful about when

More information

Intro. Scheme Basics. scm> 5 5. scm>

Intro. Scheme Basics. scm> 5 5. scm> Intro Let s take some time to talk about LISP. It stands for LISt Processing a way of coding using only lists! It sounds pretty radical, and it is. There are lots of cool things to know about LISP; if

More information

Instructions for Using the Databases

Instructions for Using the Databases Appendix D Instructions for Using the Databases Two sets of databases have been created for you if you choose to use the Documenting Our Work forms. One set is in Access and one set is in Excel. They are

More information

the NXT-G programming environment

the NXT-G programming environment 2 the NXT-G programming environment This chapter takes a close look at the NXT-G programming environment and presents a few simple programs. The NXT-G programming environment is fairly complex, with lots

More information

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners

Getting Started. Excerpted from Hello World! Computer Programming for Kids and Other Beginners Getting Started Excerpted from Hello World! Computer Programming for Kids and Other Beginners EARLY ACCESS EDITION Warren D. Sande and Carter Sande MEAP Release: May 2008 Softbound print: November 2008

More information

Windows Script Host Fundamentals

Windows Script Host Fundamentals O N E Windows Script Host Fundamentals 1 The Windows Script Host, or WSH for short, is one of the most powerful and useful parts of the Windows operating system. Strangely enough, it is also one of least

More information

How to approach a computational problem

How to approach a computational problem How to approach a computational problem A lot of people find computer programming difficult, especially when they first get started with it. Sometimes the problems are problems specifically related to

More information

Get JAVA. I will just tell you what I did (on January 10, 2017). I went to:

Get JAVA. I will just tell you what I did (on January 10, 2017). I went to: Get JAVA To compile programs you need the JDK (Java Development Kit). To RUN programs you need the JRE (Java Runtime Environment). This download will get BOTH of them, so that you will be able to both

More information

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet.

The name of our class will be Yo. Type that in where it says Class Name. Don t hit the OK button yet. Mr G s Java Jive #2: Yo! Our First Program With this handout you ll write your first program, which we ll call Yo. Programs, Classes, and Objects, Oh My! People regularly refer to Java as a language that

More information

Jump to: Using AAUP Photos AAUP Logos Embedding the AAUP Twitter Feed Embedding the AAUP News Feed CREATING A WEBSITE

Jump to: Using AAUP Photos AAUP Logos Embedding the AAUP Twitter Feed Embedding the AAUP News Feed CREATING A WEBSITE Jump to: Using AAUP Photos AAUP Logos Embedding the AAUP Twitter Feed Embedding the AAUP News Feed CREATING A WEBSITE You can make a simple, free chapter website using Google Sites. To start, go to https://sites.google.com/

More information

Microsoft System Center Configuration Manager Dell Factory Integration

Microsoft System Center Configuration Manager Dell Factory Integration Microsoft System Center Manager Dell Factory Integration User Guide September 2018 to ConfigMgr OSD in Dell Factories Administrators of Microsoft System Center Manager (referenced as Manager or ConfigMgr

More information

CHAPTER 1 COPYRIGHTED MATERIAL. Finding Your Way in the Inventor Interface

CHAPTER 1 COPYRIGHTED MATERIAL. Finding Your Way in the Inventor Interface CHAPTER 1 Finding Your Way in the Inventor Interface COPYRIGHTED MATERIAL Understanding Inventor s interface behavior Opening existing files Creating new files Modifying the look and feel of Inventor Managing

More information

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division CS 164 Spring 2005 P. N. Hilfinger Project #2: Static Analyzer for Pyth Due: Wednesday, 6 April

More information

Table of Laplace Transforms

Table of Laplace Transforms Table of Laplace Transforms 1 1 2 3 4, p > -1 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 Heaviside Function 27 28. Dirac Delta Function 29 30. 31 32. 1 33 34. 35 36. 37 Laplace Transforms

More information

CS125 : Introduction to Computer Science. Lecture Notes #11 Procedural Composition and Abstraction. c 2005, 2004 Jason Zych

CS125 : Introduction to Computer Science. Lecture Notes #11 Procedural Composition and Abstraction. c 2005, 2004 Jason Zych CS125 : Introduction to Computer Science Lecture Notes #11 Procedural Composition and Abstraction c 2005, 2004 Jason Zych 1 Lecture 11 : Procedural Composition and Abstraction Solving a problem...with

More information

This book is about using Visual Basic for Applications (VBA), which is a

This book is about using Visual Basic for Applications (VBA), which is a In This Chapter Describing Access Discovering VBA Seeing where VBA lurks Understanding how VBA works Chapter 1 Where VBA Fits In This book is about using Visual Basic for Applications (VBA), which is a

More information

Lab 7 Unit testing and debugging

Lab 7 Unit testing and debugging CMSC160 Intro to Algorithmic Design Blaheta Lab 7 Unit testing and debugging 13 March 2018 Below are the instructions for the drill. Pull out your hand traces, and in a few minutes we ll go over what you

More information

COPYRIGHTED MATERIAL. Getting Started with Google Analytics. P a r t

COPYRIGHTED MATERIAL. Getting Started with Google Analytics. P a r t P a r t I Getting Started with Google Analytics As analytics applications go, Google Analytics is probably the easiest (or at least one of the easiest) available in the market today. But don t let the

More information

Guide to Using the Unix version of the LC-2 Simulator

Guide to Using the Unix version of the LC-2 Simulator Guide to Using the Unix version of the LC-2 Simulator by Kathy Buchheit The University of Texas at Austin copyright, Kathy Buchheit January 2001 Guide to Using the Unix version of the LC-2 Simulator The

More information

Interface. 2. Interface Adobe InDesign CS2 H O T

Interface. 2. Interface Adobe InDesign CS2 H O T 2. Interface Adobe InDesign CS2 H O T 2 Interface The Welcome Screen Interface Overview The Toolbox Toolbox Fly-Out Menus InDesign Palettes Collapsing and Grouping Palettes Moving and Resizing Docked or

More information

Week 3. This is CS50. Harvard University. Fall Cheng Gong

Week 3. This is CS50. Harvard University. Fall Cheng Gong This is CS50. Harvard University. Fall 2014. Cheng Gong Table of Contents Command-Line Arguments... 1 Memory Access... 5 Return Values... 6 More on argv... 8 Sorting... 10 Bubble Sort... 11 Selection Sort...

More information

This is a book about using Visual Basic for Applications (VBA), which is a

This is a book about using Visual Basic for Applications (VBA), which is a 01b_574116 ch01.qxd 7/27/04 9:04 PM Page 9 Chapter 1 Where VBA Fits In In This Chapter Describing Access Discovering VBA Seeing where VBA lurks Understanding how VBA works This is a book about using Visual

More information

(Python) Chapter 3: Repetition

(Python) Chapter 3: Repetition (Python) Chapter 3: Repetition 3.1 while loop Motivation Using our current set of tools, repeating a simple statement many times is tedious. The only item we can currently repeat easily is printing the

More information

Final Project: LC-3 Simulator

Final Project: LC-3 Simulator Final Project: LC-3 Simulator Due Date: Friday 4/27/2018 11:59PM; No late handins This is the final project for this course. It is a simulator for LC-3 computer from the Patt and Patel book. As you work

More information

Here we will look at some methods for checking data simply using JOSM. Some of the questions we are asking about our data are:

Here we will look at some methods for checking data simply using JOSM. Some of the questions we are asking about our data are: Validating for Missing Maps Using JOSM This document covers processes for checking data quality in OpenStreetMap, particularly in the context of Humanitarian OpenStreetMap Team and Red Cross Missing Maps

More information

Functions and Decomposition

Functions and Decomposition Unit 4 Functions and Decomposition Learning Outcomes Design and implement functions to carry out a particular task. Begin to evaluate when it is necessary to split some work into functions. Locate the

More information

CSE 374 Programming Concepts & Tools

CSE 374 Programming Concepts & Tools CSE 374 Programming Concepts & Tools Hal Perkins Fall 2017 Lecture 11 gdb and Debugging 1 Administrivia HW4 out now, due next Thursday, Oct. 26, 11 pm: C code and libraries. Some tools: gdb (debugger)

More information

Getting Started. In this chapter, you will learn: 2.1 Introduction

Getting Started. In this chapter, you will learn: 2.1 Introduction DB2Express.book Page 9 Thursday, August 26, 2004 3:59 PM CHAPTER 2 Getting Started In this chapter, you will learn: How to install DB2 Express server and client How to create the DB2 SAMPLE database How

More information

Customizing DAZ Studio

Customizing DAZ Studio Customizing DAZ Studio This tutorial covers from the beginning customization options such as setting tabs to the more advanced options such as setting hot keys and altering the menu layout. Introduction:

More information

This video is part of the Microsoft Virtual Academy.

This video is part of the Microsoft Virtual Academy. This video is part of the Microsoft Virtual Academy. 1 In this session we re going to talk about building for the private cloud using the Microsoft deployment toolkit 2012, my name s Mike Niehaus, I m

More information

Term Definition Introduced in: This option, located within the View tab, provides a variety of options to choose when sorting and grouping Arrangement

Term Definition Introduced in: This option, located within the View tab, provides a variety of options to choose when sorting and grouping Arrangement 60 Minutes of Outlook Secrets Term Definition Introduced in: This option, located within the View tab, provides a variety of options to choose when sorting and grouping Arrangement messages. Module 2 Assign

More information

Installing Dolphin on Your PC

Installing Dolphin on Your PC Installing Dolphin on Your PC Note: When installing Dolphin as a test platform on the PC there are a few things you can overlook. Thus, this installation guide won t help you with installing Dolphin on

More information

Understanding Recursion

Understanding Recursion Understanding Recursion Brian L. Stuart February 23, 2015 It has been suggested that the single most original contribution that the field of Computer Science has made to the tapestry of human intellect

More information

An administrator s guide

An administrator s guide S AMPLE CHAPTER Covers PowerShell 3.0 An administrator s guide Don Jones Richard Siddaway Jeffery Hicks MANNING PowerShell in Depth by Don Jones Richard Siddaway Jeffery Hicks Chapter 1 Copyright 2013

More information

Without further ado, let s go over and have a look at what I ve come up with.

Without further ado, let s go over and have a look at what I ve come up with. JIRA Integration Transcript VLL Hi, my name is Jonathan Wilson and I m the service management practitioner with NHS Digital based in the United Kingdom. NHS Digital is the provider of services to the National

More information

Learn PowerShell Toolmaking in a Month of Lunches

Learn PowerShell Toolmaking in a Month of Lunches 6$03/( &+$37(5 Learn PowerShell Toolmaking in a Month of Lunches by Don Jones and Jeffery Hicks Chapter 13 Copyright 2013 Manning Publications brief contents PART 1 INTRODUCTION TO TOOLMAKING...1 1 Before

More information

Taskbar: Working with Several Windows at Once

Taskbar: Working with Several Windows at Once Taskbar: Working with Several Windows at Once Your Best Friend at the Bottom of the Screen How to Make the Most of Your Taskbar The taskbar is the wide bar that stretches across the bottom of your screen,

More information

Introduction to Programming

Introduction to Programming CHAPTER 1 Introduction to Programming Begin at the beginning, and go on till you come to the end: then stop. This method of telling a story is as good today as it was when the King of Hearts prescribed

More information

Microsoft System Center Configuration Manager 2012 Dell Factory Integration

Microsoft System Center Configuration Manager 2012 Dell Factory Integration Microsoft System Center Manager 2012 Dell Factory Integration User Guide January 2017 to ConfigMgr 2012 OSD in Dell Factories Administrators of Microsoft System Center Manager 2012 (referenced as Manager

More information

Part I: Programming Access Applications. Chapter 1: Overview of Programming for Access. Chapter 2: Extending Applications Using the Windows API

Part I: Programming Access Applications. Chapter 1: Overview of Programming for Access. Chapter 2: Extending Applications Using the Windows API 74029c01.qxd:WroxPro 9/27/07 1:43 PM Page 1 Part I: Programming Access Applications Chapter 1: Overview of Programming for Access Chapter 2: Extending Applications Using the Windows API Chapter 3: Programming

More information

Chapter 2.6: Testing and running a solution

Chapter 2.6: Testing and running a solution Chapter 2.6: Testing and running a solution 2.6 (a) Types of Programming Errors When programs are being written it is not surprising that mistakes are made, after all they are very complicated. There are

More information

Clean & Speed Up Windows with AWO

Clean & Speed Up Windows with AWO Clean & Speed Up Windows with AWO C 400 / 1 Manage Windows with this Powerful Collection of System Tools Every version of Windows comes with at least a few programs for managing different aspects of your

More information

YCL Session 4 Lesson Plan

YCL Session 4 Lesson Plan YCL Session 4 Lesson Plan Summary In this session, students will learn about functions, including the parts that make up a function, how to define and call a function, and how to use variables and expression

More information

Project 3: Implementing a List Map

Project 3: Implementing a List Map Project 3: Implementing a List Map CSCI 245 Programming II: Object-Oriented Design Spring 2017 Devin J. Pohly (adapted from Thomas VanDrunen) This project has two main goals: To give you practice in implementing

More information

The Perl Debugger. Avoiding Bugs with Warnings and Strict. Daniel Allen. Abstract

The Perl Debugger. Avoiding Bugs with Warnings and Strict. Daniel Allen. Abstract 1 of 8 6/18/2006 7:36 PM The Perl Debugger Daniel Allen Abstract Sticking in extra print statements is one way to debug your Perl code, but a full-featured debugger can give you more information. Debugging

More information

Programming assignment A

Programming assignment A Programming assignment A ASCII Minesweeper Official release on Feb 14 th at 1pm (Document may change before then without notice) Due 5pm Feb 25 th Minesweeper is computer game that was first written in

More information

Creating Word Outlines from Compendium on a Mac

Creating Word Outlines from Compendium on a Mac Creating Word Outlines from Compendium on a Mac Using the Compendium Outline Template and Macro for Microsoft Word for Mac: Background and Tutorial Jeff Conklin & KC Burgess Yakemovic, CogNexus Institute

More information

GDB Tutorial. A Walkthrough with Examples. CMSC Spring Last modified March 22, GDB Tutorial

GDB Tutorial. A Walkthrough with Examples. CMSC Spring Last modified March 22, GDB Tutorial A Walkthrough with Examples CMSC 212 - Spring 2009 Last modified March 22, 2009 What is gdb? GNU Debugger A debugger for several languages, including C and C++ It allows you to inspect what the program

More information

Dynamism and Detection

Dynamism and Detection 1 Dynamism and Detection c h a p t e r ch01 Page 1 Wednesday, June 23, 1999 2:52 PM IN THIS CHAPTER Project I: Generating Platform-Specific Content Project II: Printing Copyright Information and Last-Modified

More information

Introduction. 1.1 Who this book is for. This chapter covers. What the book will and won t teach The boundaries of this book Going beyond PowerShell

Introduction. 1.1 Who this book is for. This chapter covers. What the book will and won t teach The boundaries of this book Going beyond PowerShell Introduction This chapter covers What the book will and won t teach The boundaries of this book Going beyond PowerShell As of this writing, Windows PowerShell is approaching its sixth year of existence

More information

Getting Started with Visual Basic 2005 Express Edition

Getting Started with Visual Basic 2005 Express Edition 4398book.fm Page 1 Tuesday, February 14, 2006 1:53 PM Part 1 Getting Started with Visual Basic 2005 Express Edition In this section: Chapter 1: Welcome to Visual Basic 2005 Express Edition Chapter 2: Using

More information

(Refer Slide Time 6:48)

(Refer Slide Time 6:48) Digital Circuits and Systems Prof. S. Srinivasan Department of Electrical Engineering Indian Institute of Technology Madras Lecture - 8 Karnaugh Map Minimization using Maxterms We have been taking about

More information

Best Practices for Upgrading to SQL Server By Haldong Alex Ji

Best Practices for Upgrading to SQL Server By Haldong Alex Ji Best Practices for Upgrading to SQL Server 2005 By Haldong Alex Ji Published: December 2007 Best Practices for Upgrading to SQL Server 2005 Contents Choose a 64-bit System When You Can... 1 Moving to SQL

More information