Need to see if all Critical Updates are installed on a Windows Server in VBScript - vbscript

I have a requirement where I need to check Remote Servers to see if all of their Critical updates are installed and then return PASS or FAIL.
Is there a way with WMI for me to do this with VBScript?
EDIT:
I did find this
Windows Update Check with vbscript but it only works on the local machine and not remote.

This link with UpdateHF_v2.6a.vbs by Rob Dunn is made to work with all versions of Windows. It's made with VBS to use WMI, and works on local and remote hosts.. I've been using 2.5a for years. There is no changelog, though Rob is updating the script in response to feedback.
http://community.spiceworks.com/scripts/show/82-windows-update-agent-force-script-email-results-version-2-6
If you need "wrappers" to do this in bulk using a list of computers and psexec to run it, let me know. :)

Related

Possible ways to run windows batch command from Unix

I am trying to run a windows batch command from CentOS 6. I would like to know the best way to achieve this. I explored PsExec and WinExe utilities in unix to connect to windows machine and run the required commands.
I am trying this on a windows VM which is within company network, hence kindly highlight any specific network issues that I may have to check for the setup to run.
Any pointers would help.
Have you seen the examples from the PowerShell for Linux GitHub pages, as the working examples seem to cover this off nicely?
https://github.com/PowerShell/PowerShell/tree/master/demos/SSHRemoting
It will require SSH installed onto your Windows server, but otherwise seems to tick all of your boxes.

Executing QTP Tests from a remote machine

There are some questions regarding this topic, but thought I'd ask my about my unique situation...
Background - We are attempting to execute a QTP script via Jenkins. Now, Jenkins is running on a Windows Server, on which we are having some QTP install issues (that topic is for another thread...). As a workaround, I am trying to execute a simple AOM VBScript invoking QTP on a remote client machine (running Windows XP) and execute the test on that machine...
Setup - Just for initial proof-of-concepts, a .VBS file located on a Windows 7 box (the "calling box") has the following command:
Set qtpApp = CreateObject("QuickTest.Application","WinXPMachineName")
Problem - I am getting the following error on the calling box:
ActiveX component can't create object: 'QuickTest.Application'
I have followed the instructions to set up QTP for remote execution on the Windows XP machine. Note that QTP isn't installed on the Window 7 box .
QuickTest Pro must be installed on the local machine (in your case, your Windows 7 computer) even though you'll ultimately launch QTP elsewhere. This is because Set qtApp = CreateObject("QuickTest.Application", "MyServer") summons the local installation of QTP to open. Once the local QTP is open, it should communicate with the remote server and instruct the remote server to begin the test cases.
So, yes, you will need QTP installed on the local machine. (This is not troublesome if you have concurrent aka 'floating' licenses. If you have the seat licenses, that means they are paying for each individual computer that QTP is installed on. If that's the case, I don't know what to recommend.)
An alternate method:
I've been wrestling with remotely-launching QTP test scripts, particularly by launching them through the Windows Task Scheduler (That way, you wouldn't need QTP on the local machine, only on the remote machine). Here are a few questions I've had that hopeful might blaze a trail:
How can I run a QTP test from the command line?
Remotely managing Scheduled Tasks on another computer: Access
Denied
Unable to remotely schedule tasks from the command line
I was using another automation tool than QTP but I faced the same issue.
I was told I had to have the software "QAWP" installed in both machines to be able to run it remotely, but my company was reluctant on buying a second license for just this and wanted another solution 'Cheaper one'. So:
In the test machine have a batch file that executes your tests.
Add a scheduled tasks in windows that calls your batch file.
from any other machine you can start the scheduled tasks using the command:
schtasks /run /s /tn
both launch and remote machines have to be in the same domain and logged in as the same user that you gave access in the DCOM settings
turn off firewall if possible or add qtp to the exceptions
works perfectly for me
Can anyone tell if Set qtApp = CreateObject("QuickTest.Application", "MyServer") works if working with QTP trail version?
I have QTP trail version on two Win7 64bit machine.
When I use the above code to start QTP on my remote machine form vbscript then it works.
But when i try executing it from QTP it fails.
I have the right DCOM settings and all administrative privileges on both machines and my QTP is also running as admin.
So does it only work when I have licence installed?
To add more info to whoever still looking for answer to invoke QTP/UFT in remote machines:
Using VBScript to invoke QTP/UFT tests in remote machine is old school approach. I would suggest you to use Jenkins. It has tons of advantages.
Check here for more details.

Simulating logging in to Windows without GUI

I am writing an automation the deployes several machines and installs several programs on them.
One of the steps a user would do manually is logging off and on to a windows computer as part of an installation process.
Can someone please point me to relevant links so i can understand how to simulate a logging in process into windows without a gui?
I mean i need to make the machine think someone logged in to it and i am using only powershell.
launching mstsc does not do the trick because i cant overcome the request for certificate (I need an automatic process but i did not find a way to silence the certificate warning)
I searched for a couple of days and could not find what I was looking for.
Thank you for your help!
It's just an idea. Perhaps you can first make the image of the machines with automatic logon , install the software and finally remove the automatic logon ?
This link has details about Automatic Logon
http://support.microsoft.com/kb/315231

Watir Excel call not working on virtual machine

I have a watir test that downloads some information from a web app to an Excel file, and I then open the file to confirm the contents. On my dev box everything works fine, but the scheduled automation runs (via Hudson) always fail attempting to open the Excel file. I have checked that the correct version of AutoITX3.dll is registered on both machines (Ruby 1.8, Watir 1.6.5). No other versions of AutoITx3 are registered on either machine. The error on the Hudson box is the one expected if the dll is NOT registered, but it is present in regedit in the same location as on my dev box. Both machines are WinXP.
Running the test manually on the Hudson box results in the same error -- unknown OLE server: 'Excel.Application' HRESULT error code:0x800401f3 Invalid class string.
I searched for similar errors and saw one instance where running on a virtual machine had caused similar problems, but only if the VM window was closed. I don't think this is a code error since it runs on the dev box. Any suggestions for debugging this?
TIA,
Sabrina
I find the use of Excel to be an antipattern in test automation. I know a lot of people like it, but if you're using that for automation then there are simpler ways to go about it. Consider using CSV with FasterCSV for the automation tests and checking anything into version control which I'm assuming you're using.
IMHO, you should only use Excel when a human is involved - i.e. you may a series of tests defined in CSV, but you edit them in Excel, save back and then diff against what's in a source control system, storing it as CSV.
Excel is useless to diff, so it doesn't store well in a source repo, there's no reason to install it on a CI box when CSV will do and do better.
That's my 2 cents anyhow. :)
Cheers,
Charley
I would do another search for the issue and leave Watir out of it. I can find several issues for 0x800401f3 associated with FoxPro, Perl, and Oracle.
Have a look at this article http://support.persits.com/show.asp?code=PS01032622
It names the possible causes for your error code.
bq. This error means that either the component has not been registered on the server or the ProgID passed to the Server.CreateObject method is misspelled. On Windows 2003 and XP, it may also mean a permission problem on a system registry key.
I think for you the last one is relevant:
bq. On Windows 2003 and XP, it may also mean a permission problem on a system registry key.
BTW, I googled for ":0x800401f3 Invalid class string." and this was the first result.
What are you trying to test?
That user can open downloaded file with Excel? How do you verify that automatically? With screen shot?
Or that some data is in the file? In that case I would verify contents of the file with something like roo.
I finally figured it out. What I thought was a working Excel install on the remote machine was instead the free Excel reader, which does not have the API hooks WIN32OLE looks for in the registry. Installed the full Excel program and now everything works. I knew the Universe would be consistent!

How do I remotely obtain a system's network shares and connections?

I'm looking for a way to obtain information similar to the following console applications, remotely:
net use
net share
netstat -ano
However, I need to be able to do this without running a 3rd party application on the system. This effectively rules out using psexec to execute the command remotely, because psexec would then be installed as a service.
I should add that I have administrative credentials on the remote system. I've considered using WMI's remote execution ability, but that requires me to write output to a file and then retrieve it. It's possible, but I'd like to know if anyone has a better way.
I am using Delphi 2010.
there are a couple Delphi WMI components that allow remote access. I have not used the remote options personally though.
MagWmi - http://www.magsys.co.uk/delphi/magwmi.asp (Delphi 2010 support, and free with source)
WMISet/NTSet - http://www.online-admin.com/ntset.html (TNTShare
Manages shared resources on a local computer and remote hosts. Using this component you can change list of shared devices, see files that have been opened by remote users, watch and terminate remote sessions opened to the destination computer, change list of mapped network drives. It is not free.)
GLibWMI - Found at Torry.net, home page not available. (Delphi 2010 support and Freeware with source). Not sure if its capable of remote access. I have not used it.
Hope this helps
I think the same as Logman.
You can access this information using WMI.
GLibWMI components can be found on this website (http://neftali.clubdelphi.com) or sourceforge (http://sourceforge.net/projects/glibwmi/).
The current version is 1.8b and has a component called SharedInfo with which you can get that information.
The source code is available so you can expand it to access other WMI classes if necessary.
Regards.
P.D: Sorry for my mistakes with english.
You can enumerate shares using the NetShareEnum function (headers are in the Jedi Apilib).
I assume there must be an api for the "net use" but I have never used it (check the WNet functions). Alternative is to use the EnumNetworkDrives method of the WshNetwork com object.
As for netstat I don't think it's possible to do that remotely (other than using some kind of method to spawn a process remotely).

Resources