• 0

VB.NET WSUS Final Question


Question

I can do things like this.. Console.WriteLine(computer.Model)

But, when I try computer.OSInfo - it gives me an error. It says OSInfo cannot be used in a string.

Anybody got any ideas how I can display it?

Thanks! :)

OSInfo : http://msdn.microsoft.com/library/default....rget_osinfo.asp

Link to comment
https://www.neowin.net/forum/topic/422389-vbnet-wsus-final-question/
Share on other sites

17 answers to this question

Recommended Posts

  • 0
  coolant said:

I can do things like this.. Console.WriteLine(computer.Model)

But, when I try computer.OSInfo - it gives me an error. It says OSInfo cannot be used in a string.

Anybody got any ideas how I can display it?

Thanks! :)

OSInfo : http://msdn.microsoft.com/library/default....rget_osinfo.asp

Ok, since I dont have that DLL on my system Im going to make a blanket "duh" statment on the off chance you MIGHT have forgotten this or just didnt know. Almost all .NET objects have a ".ToString" value. Check it out with OSInfo.ToString. If you have, or it doesnt have it also try "Cstr(OSInfo)" (without the quotes of course)

  • 0

Here is the full code (I am learning VB.NET).

'This sends the database the names of the computers and groups that they are in.
Imports Microsoft.UpdateServices.Administration
Imports System.Data
Imports System.Data.Odbc

Module NameGroupsToDatabase

	Sub Main()

		Dim Server As IUpdateServer
		Dim AdminProxy As AdminProxy
		Dim Computers As ComputerTargetCollection
		Dim InstallStatus As UpdateInstallationInfoCollection

		'connect to MySQL
		Dim MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=*****; DATABASE=*******; UID=****; PASSWORD=******; OPTION=3;"
		Dim MyConnection As New OdbcConnection(MyConString)
		MyConnection.Open()

		'drop computerinfo table
		Dim MyCommand As New OdbcCommand
		MyCommand.Connection = MyConnection
		MyCommand.CommandText = "DROP TABLE IF EXISTS computerinfo"
		MyCommand.ExecuteNonQuery()
		MyCommand.CommandText = "DROP TABLE IF EXISTS computerstatus"
		MyCommand.ExecuteNonQuery()

		'create computerinfo table
		MyCommand.CommandText = "CREATE TABLE computerinfo(id varchar(36), groupname varchar(100), compname varchar(100))"
		MyCommand.ExecuteNonQuery()

		'create computerstatusinfo table
		MyCommand.CommandText = "CREATE TABLE computerstatus(id varchar(36), make varchar(100), model varchar(120), proc varchar(120), bios varchar(120))"
		MyCommand.ExecuteNonQuery()

		Console.WriteLine("Obtaining status...")

		'connect to the local server
		AdminProxy = New AdminProxy
		Server = AdminProxy.GetUpdateServer

		'get a collection of the computers on this server
		Computers = Server.GetComputerTargets()

		'loop through the computer collection 
		For Each computer As IComputerTarget In Computers

			'insert into database
			MyCommand.CommandText = "INSERT INTO computerinfo VALUES('" & computer.Id & "', '" & computer.RequestedTargetGroupName & "', '" & computer.FullDomainName & "')"
			MyCommand.ExecuteNonQuery()

			MyCommand.CommandText = "INSERT INTO computerstatus VALUES('" & computer.Id & "', '" & computer.Make & "', '" & computer.Model & "', '" & computer.ProcessorArchitecture & "', '" & computer.OSInfo & "')"
			MyCommand.ExecuteNonQuery()

			Console.WriteLine(computer.FullDomainName & " sent to the database")
			'stupid Next command
		Next
		End
	End Sub

End Module

When I move my mouse over computer.OSInfo - it says that & is not designed for that kind of string.

  • 0

I believe it is becuase OSInfo is an object, not just a version number. My guess is that if you let intellisense pick up with "OSInfo." you would get a list of information. A quick peek on Google brought me to the MSDN site that proved my point. Sorry I dont have the DLL installed to give you specifics.

  • 0

Intellisense is, or at least SHOULD be on by default. By pressing the period ( . ) after an object intellisense will give you a list of functions and properties. See attached image. I created an integer (i), then assigned it a value (3) and then went to print it i. and got this:

Intellisence.jpg

  • 0

For computer.OSInfo it says

"Public Overridale ReadOnly Property OSInfo() As Microsoft.UpdateServices.Administration.OSInfo"

while computer.Model says

"Public Overridale ReadOnly Property Model() As String"

How can I display computer.OSInfo? A loop of some sort?

  • 0

Ok, let's try it this way, your code looks like this:

>> MyCommand.CommandText = "INSERT INTO computerstatus VALUES('" & computer.Id & "', '" & computer.Make & "', '" & computer.Model & "', '" & computer.ProcessorArchitecture & "', '" & computer.OSInfo & "')"

>>

Pull out

"computer.OSInfo"

and place it on it's own line of code

and then after "OsInfo" place a "." so it says:

"computer.OSInfo."

When you place the period after OSInfo do you get a list like the image in my prior post?

If this is still an issue can you give us a small screen shot (damn I wish i had the DLL, but im not muckin up my comp for your code.... deal with it :)

  • 0
  jameswjrose said:

Glad you got it. And yea, a newbie book would be good. I always recommend the "Dummies" books, it shoulds like Im being rude to sugest it, but actually those books are good primers.

Best of luck

Definately. Coming from a PHP person to VB.NET - It can be tricky. OOP is harder then I thought :x

  • 0
  jameswjrose said:

Yes OO is harder than you, or anyone thought, but it does get better. The moment you REALLY get that everything (almost) is an object and what that means will be a cool moment.

Or atleast know what my posibilites are! Now I'm having fun!

Now if I could figure out how to grab the size of a harddrive through WSUS ;)

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Kdenlive 25.04.2 by Razvan Serea Kdenlive is an acronym for KDE Non-Linear Video Editor. It works on GNU/Linux, Windows and BSD. Through the MLT framework, Kdenlive integrates many plugin effects for video and sound processing or creation. Furthermore Kdenlive brings a powerful titling tool, a DVD authoring (menus) solution, and can then be used as a complete studio for video creation. Kdenlive supports all of the formats supported by FFmpeg or libav (such as QuickTime, AVI, WMV, MPEG, and Flash Video, among others), and also supports 4:3 and 16:9 aspect ratios for both PAL, NTSC and various HD standards, including HDV and AVCHD. Video can also be exported to DV devices, or written to a DVD with chapters and a simple menu. Video editing features: Multi-track editing with a timeline and supports an unlimited number of video and audio tracks. A built-in title editor and tools to create, move, crop and delete video clips, audio clips, text clips and image clips. Ability to add custom effects and transitions. A wide range of effects and transitions. Audio signal processing capabilities include normalization, phase and pitch shifting, limiting, volume adjustment, reverb and equalization filters as well as others. Visual effects include options for masking, blue-screen, distortions, rotations, colour tools, blurring, obscuring and others. Configurable keyboard shortcuts and interface layouts. Rendering is done using a separate non-blocking process so it can be stopped, paused and restarted. Kdenlive also provides a script called the Kdenlive Builder Wizard (KBW) that compiles the latest developer version of the software and its main dependencies from source, to allow users to try to test new features and report problems on the bug tracker. Project files are stored in XML format. An archiving feature allows exporting a project among all assets into a single folder or compressed archive. Built-in audio mixer Highlights from the Kdenlive 25.04.2 update: Remember title editor window width Fix audio thumbnails have an offset in long files Fix OTIO import path on Windows Better feedback when auto mask fails Fix OTIO export tracks order and ensure .otio file extension is correctly added Full Changelog Fix moving subtitle with grab. Fix empty gradient in config causes crash. Snapcraft: Give more permissions for microphone access. Backport missing effects xml. Fix quick markers not taking clip crop into account in timeline. Fix marker dialog not allowing to add marker if only 1 category exists. Fix merge error causing freeze on exit. Fix crash in HistogramGenerator when running on a white color clip. Fix Whisper model directory not being created if asked to do so. Fix canceling quit on rendering leaves kdenlive in unstable state. Only clear undo stack when we delete a timeline sequence, not a standard bin clip. Fix misalignment of monitor tools CCBUG: 498337 CCBUG:461219. Fix OTIO path issue on import, related to #1998. Fix bin clip effects disappear after disabling a timeline clip. Fix keyframe in monitor not correctly reported on clip selection. Fix monitor scene not correcty activated on clip selection. Fix small error causing offset in long audio thumbnails. Fix guides list buttons not working on app opening. Fix built-in effects disabled state changes on cut. Fix render widget target file can have no extension or incorrect path. SAM2: show message and full log if the python script crashes, try to auto reinstall if the venv python exe is missing. Save and restore title editor window width. Download: Kdenlive 25.04.2 | 116.0 MB (Open Source) Download: Standalone Executable Links: Kdenlive Home page | Other Operating Systems Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • I use Edge on my Mac. Edge is lightning fast and does everything. Never had an issue with it. It alsoi allows the use of the original uBlock Origin extension, which Chrome does not allow anymore. I hate ads.
    • AIMP 5.40 Build 2682 by Razvan Serea AIMP is a powerful audio player that allows you to listen to your favorite music with an outstanding sound quality. Its appearance resembles that of another classical audio player (Winamp). The program includes a 20-band equalizer, a visualization window to display rhythmic visual effects and a playlist editor to organize your audio files. A nice fading effect makes your list of songs look like an endless music loop and a handy volume normalizing feature avoids drastic volume changes between tracks. Also, the players main functions can be conveniently controlled by global hotkeys. Besides playing music, AIMP features three extra utilities which also enable you to record any sound on your computer, convert audio files from one format to another and view or edit tags. AIMP is based on the well-known audio engine BASS, so its easy to connect new plug-ins (from the plug-in library included in the program) and expand the players functionality. Main Features and Functions: Multi-Format Playback: Supports numerous audio formats, including CDA, AAC, AC3, APE, DTS, FLAC, IT, MIDI, MO3, MOD, M4A, M4B, MP1, MP2, MP3, MPC, MTM, OFR, OGG, OPUS, RMI, S3M, SPX, TAK, TTA, UMX, WAV, WMA, WV, XM, DSF, DFF, MKA, AA3, AT3, OMA, WebM, MDZ, ITZ, S3Z, XMZ, AIFF, and MPEG-DASH (YouTube). CUE Sheet Support: Enables the use of CUE sheets for managing audio tracks. Output Support: Compatible with DirectSound, ASIO, WASAPI, and WASAPI Exclusive output methods. 32-Bit Audio Processing: Utilizes 32-bit audio processing for optimal sound quality. Internet Radio: Allows listening to internet radio stations in OGG, WAV, MP3, AAC, and AAC+ formats, with the capability to capture streams in various formats. Bookmarks and Playback Queue: Facilitates creating bookmarks and managing a playback queue. Rating and Auto-Marks: Collects statistics on track listening and automatically calculates ratings and marks for listened tracks. Plugin Support: Allows the addition of new utilities or extensions to existing features through plugins. Built-in Scrobbler: Supports Last.fm, Libre.fm, and ListenBrainz services for scrobbling. Cloud Integration: Supports OneDrive, Google Drive, DropBox, Облако@mail.ru, Яндекс.Диск, and custom WebDAV clouds. Podcasts: Offers podcast support for subscribing and listening. Hotkeys: Allows configuration of local and global hotkeys. Multi-User Mode Support: Supports multiple users working on one computer. Multi-Language Interface: Provides a multi-language interface. 4K and High DPI Support: Supports scale factors of 125%, 150%, 175%, and 200% for high-resolution displays. Flexible Program Options: Offers customizable program settings. Flexible UI: Charm UI: A modern flat-style skin with 4K and High DPI support. Bliss 4K: A skin-transformer from AIMP4 included in the installation package. Pandemic: The classic skin from AIMP3 included in the installation package. User Skins: Access to a catalog of user-created skins. Sound Effects: 20-Band Equalizer and Built-in Sound Effects: Includes Reverb, Flanger, Chorus, Pitch, Tempo, Echo, Speed, Bass, Enhancer, and Voice Remover effects with flexible settings. Volume Normalization: Features peak-based normalization and Replay Gain, along with logarithmic and loudness-compensated volume control. Mixing Options: Offers Fade In/Fade Out, cross-mixing, and pause between tracks. Silence Remover: Removes silence from tracks for a seamless listening experience. Music Library: Music Library: Organizes music files, allows setting marks for listened tracks, and keeps playback statistics. Smart Playlist: Creates playlists based on content from the Music Library database, with filtering and grouping capabilities. Playlists: Multiple Playlists: Supports working with multiple playlists simultaneously. Powerful View Settings: Allows data display customization, track grouping, and separate settings for each playlist. Content Protection: Provides the ability to block content from changes. File Search: Enables searching files across all opened playlists. AIMP 5.40 Build 2682 changelog: Audio converter: support for relative paths Plugins: analog meter - installing skins using general approach to install addons Sound engine: resampler algorithm has been improved Player: AB part repeat - an ability to change milliseconds via dialog Skin engine: compatibility with the Start11 app Skin engine: memory consumption during skin loading has been reduced Fixed: Tags editor - data in tags with multiple values ​​​​may be duplicated in certain cases Fixed: tag editor - ID3v2.4 - multiple genre values ​​cannot be loaded Fixed: skin engine - minor issues has been fixed Fixed: issues from incoming crash-reports Download: AIMP 64-bit | AIMP 32-bit ~20.0 MB (Freeware) View: AIMP Website | Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • Can you point out where his walkthrough of Mozilla's finances are lies?
    • Advanced Renamer 4.12 by Razvan Serea Advanced Renamer is a program for renaming multiple files and folders at once. By configuring renaming methods the names can be manipulated in various ways. It is easy to set up a batch job using multiple methods on a large amount of files. The 14 different methods enables you to change the names, attributes, and timestamps of files in one go. Free for personal use. You can download and use Advanced Renamer for FREE for any personal use. If you use Advanced Renamer for a business you can download and try it out for free. To continue using it, you need to buy a life time license. Image files This mass file renamer is a great utility for organising digital pictures for both professionals and beginners. The thumbnail mode lets you display thumbnails directly in the file list giving you maximum control of the renaming process. With this program you can rename all your photos in a snap. GPS data If your image files contain GPS data you can add the name of the city and the country where the picture was taken. Coordinates are used to lookup city, country, and state names from a database containing more than 100,000 cities around the globe. Music files MP3 and other music files often have messed up names and contain weird characters. With Advanced Renamer you can change the names of your favourite music files to more suitable names using the built-in ID3 functions. Video files Ever wanted to add the codec or the resolution of a video to the filename? With the video tags you can add various information about video and audio content to the names. TV shows Add episode title or airdate to video files containing TV Shows after importing show information from the tvmaze.com website. Advanced Renamer 4.12 changelog: Upgraded regular expression engine for use in renaming methods Replace method: Named group substitution is now supported in regular expressions (e.g., (?.*) and ${name}) Program is now less likely to crash when config file is corrupted Fixed an edge case bug in List Replace method Fixed large file support in ExifTool integration Improved reading XMP metadata from MP4 files ExifTool field names sometimes showed up in lists where they were not supported Will no longer show error "Extension changed" when new name is blank Disc and DiscCount metadata now correctly recognized for MP3 files Item details would sometimes show the same fields multiple times Additional metadata fields is now supported for MP4 files: AudioFormat, AudioChannels, AudioSampleType, AudioSampleRate, CompressionID, CompressionName, BitDepth, XResolution, YResolution More robust handling of MP4 files with corrupted data Added support for extracting metadata from some older QuickTime .mov files Fixed an issue reading GPS metadata from image and video files, when formattet in a certain way Improved MKV file metadata support Added support for metadata fields AudioFormat, AudioChannels, and AudioSampleRate for AVI files Import from CSV did not remember the last used column index for original filename Fixed name collision rule "Append image sub second" When using name collision rule "Append image sub second", the rule will now be applied to all items in the list with the same name Improved performance for JPEG files containing long XMP Extended metadata MacOS: Item preview panel will now use embedded thumbnails for JPEGs for better performance Download: Advanced Renamer 4.12 | Portable ~12.0 MB (Free for personal use) Link: Advanced Renamer Home Page | Advanced Renamer Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
  • Recent Achievements

    • Reacting Well
      Alan- earned a badge
      Reacting Well
    • Week One Done
      IAMFLUXX earned a badge
      Week One Done
    • One Month Later
      Æhund earned a badge
      One Month Later
    • One Month Later
      CoolRaoul earned a badge
      One Month Later
    • First Post
      Kurotama earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      494
    2. 2
      ATLien_0
      267
    3. 3
      +FloatingFatMan
      223
    4. 4
      +Edouard
      199
    5. 5
      snowy owl
      141
  • Tell a friend

    Love Neowin? Tell a friend!