UFT is getting killed while opening database connection - hp-uft

Running the below line result with killing UFT while executing:
gdb_Conn.Open "Driver={Microsoft ODBC for Oracle};Server=" & & ";Uid=" & ";Pwd=" & & ";"
How can I solve it?

What is the error message you get?
I expect that there are variables between the two & & and there's missing & after the uid? So it looks like this?
gdb_Conn.Open "Driver={Microsoft ODBC for Oracle};Server=" & server & ";Uid=" & uid & ";Pwd=" & password & ";"
If not you need to complete the line with the variables holding correct values (server name, user and password pair that has access to it).
Otherwise check that the server is running, you can connect to it manually, the user has access etc.

Related

Log on as local administrator in VBS

I have what should be a very simple script. I have a series of 6 PCs that I need to check the existence of a file and report back. Where the difficulty lies is that these devices are not part of AD and are part of a work group. From windows explorer using C$ I'm prompted to log on as a local administrator on the remote PC. How can I perform the same logon and automate the process using the script below?
Set objFSO = CreateObject("Scripting.FileSystemObject")
For i = 1 To 6
If objFSO.FileExists("\\10.4.55." & i & "\c$\Program Files\X-1 Technologies\offline.fla") Then
Wscript.Echo "Reg:" & i & " Off-Line."
Else
Wscript.Echo "Reg:" & i & " On-Line."
End If
Next
Thanks, Lloyd

how to run a vb script without user intreaction in a LAN?

I have a group of network all connected in LAN and all are in domain. And I have a VB script to get the installed software. I have to run the script on all the systems without user interaction.
If you are using WMIService in vbs, then try below with replacing strComputer in a loop, then another loop for the softwares
Set oWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2")
Set colSoftware = oWMIService.ExecQuery("Select * from Win32_Product")
But you have to run this with domain admin account or an account that is "Administrators" on all the domain PC.

can't map network drive from task scheduler - was working

We have a vbs file on our local server (A) that uses mapnetworkdrive to contact two servers at a remote location (B) and copy files from B to A. The script has been running for about 3 months with no problems. Since last week, the script has been unable to map the network drive to B if it runs from Task Scheduler, but it works fine when run from the command line or by double-clicking on the vbs file.
I know the script is running because it logs things as it runs. One of those is the error message when it tries to map the network drive. It looks like this:
boh_mapped_drive_letter = "w:"
boh_mapped_drive = "\\xxx.xxx.xxx.xxx\sharename"
NetworkObject.MapNetworkDrive boh_mapped_drive_letter, boh_mapped_drive, False, <username>, <password>
if err.number <> 0
appendToFile logfile, vbtab & "error occurred - " & vbtab & err.number & " " & err.source & " " & err.description
Err.Clear
end if
and the error I get is:
53 Microsoft VBScript runtime error File not found
What could cause the scheduled task to not be able to map the network drive but it still works by manually executing it?
When you double-click or CLI execute a vbs file, what user account does it run under? Is it different from the user account that runs it from Task Scheduler?
Looks like we were able to fix it by checking the "Run with Highest Privileges" box.

Issue while executing a vb script upon machine startup

I have a vbscript that adds a user to the local group "Administrators" which should run upon machine startup.
the basic code applied in the script is as follows:
Set objGroup = GetObject("WinNT://" & strComputer & "/" & strGroup & ",group")
' Get user object
Set objUser = GetObject("WinNT://" & strComputer & "/" & strUser & ",user")
' Add user to group
objGroup.Add(objUser.ADsPath)
Now I added a registry string to the following path:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Name : addUser
Value : "E:\addUser.vbs"
Now the peculiar behavior which I have noticed is that when a non-admin user logs in the script doesn't run. It only runs for members of Administrators group.
If this behavior is expected, then is there a way to by pass this (maybe run it under the Administrator or SYSTEM account).
Thanks and Regards,
Wriju

How to retrieve registry values remotley using vbs or batch files

I want to know, can I run a script on my computer that will return the value of a registry entry from another PC on the same network?
For instance if I wanted to know if a PC had AVG anti-virus installed, could I run a script to return the version number of AVG installed on that PC, and if it's not installed to just say it can't find it?
If it helps I know the IP, MAC address, Service TAG and computer name of the remote PC.
It would be good to reference Connecting to WMI on a Remote Computer (MSDN) and Scripts to manage Registry
Sample code would look something like this (taken from ActiveXperts):
const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
Set StdOut = WScript.StdOut
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" &_
strComputer & "\root\default:StdRegProv")
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\WinLogon"
strValueName = "UIHost"
oReg.GetExpandedStringValue HKEY_LOCAL_MACHINE,strKeyPath,_
strValueName,strValue
StdOut.WriteLine "The Windows logon UI host is: " & strValue
Where strComputer value would be replaced with the name / address of the machine.

Resources