I am trying to script for file transferring ,its works fine when am clicking manually the script.But when am trying to run as Scheduling task i receiving an error "Active component cant create obj",i don't know what went wrong in my script?
For your reference i have my script below.
Dim Mysite
Set MySite = CreateObject("CuteFTPPro.TEConnection")
Set fso = CreateObject("Scripting.FileSystemObject")
MySite.Protocol = "FTP"
MySite.Host = "www.domainname.com"
MySite.Login = "xxxxx"
MySite.Password = "xxx"
MySite.UseProxy = "BOTH"
MySite.Connect
MySite.UploadAsync "C:\sampletest\abc.flv"
MySite.RemoteFolder = "/test/abc.flv"
MySite.Disconnect
MySite.Close
FYI my machine is windows 2008 64 bit system
In most cases issue raised by one of the following:
User does not have proper permission to run a scheduler
User does not have proper access to the folders/files listed
Application you are using running under different permission set for logged in user and system account which is used by Task Scheduler.
OS is not recognizing what application version it have to execute 32 or 64 bit when attempt to execute scheduled task.
Take a closer look on those situations, make adjustments and it will work.
Related
Background
I am designing an Inno Setup installer to install a Cygwin service, and I am puzzled by the behavior I'm seeing from the Windows Restart Manager APIs.
Specifically, when the service is running (started using the cygrunsrv utility), the RmGetList API function returns 2 (RmRebootReasonSessionMismatch) for its lpdwRebootReasons output parameter. This output parameter is an enumeration of type RM_REBOOT_REASON, and the description on MSDN for the RmRebootReasonSessionMismatch value is:
One or more processes are running in another Terminal Services session.
The Inno Setup log file contains lines like the following:
RestartManager found an application using one of our files: <executable name>
RestartManager found an application using one of our files: <service name>
Can use RestartManager to avoid reboot? No (2: Session Mismatch)
Inno Setup then proceeds trying to replace in-use files, as if Restart Manager was not used at all.
I am puzzled by this output value, because on two different machines I tested (Windows 10 1909 x64 and Windows Server 2012 R2), no terminal server/remote desktop users are logged on.
If I stop the service and start another executable (in the set of files to be replaced by the installer), RmGetList returns 0 (RmRebootReasonNone) for lpdwRebootReasons, and Inno Setup displays the normal dialog for in-use files and allows the user to select to automatically close them.
Process Explorer shows both processes (cygrunsrv.exe and the process it starts) running in session 0 and at System integrity level. Both are console subsystem executables.
Questions
Under what conditions does RmGetList return 2 (RmRebootReasonSessionMismatch) for its lpdwRebootReasons output parameter? (I'm trying to understand why this happens when the service is running.)
Does this value cause the entire Restart Manager session to fail, or can Restart Manager proceed even though it thinks applications are running in one or more different sessions?
For question 2, in the document RM_PROCESS_INFO
bRestartable
TRUE if the application can be restarted by the Restart Manager;
otherwise, FALSE. This member is always TRUE if the process is a
service. This member is always FALSE if the process is a critical
system process.
This value indicates if the application can be restarted by the Restart Manager.
For question 1, Note that services are running in session 0. If the process occupying the resource (registered in RmRegisterResources) is a service A, the RmGetList function which also running in the service process B will return lpdwRebootReasons = RmRebootReasonNone, bRestartable = TRUE.
But if A is not a service, then A & B are running in different sessions, lpdwRebootReasons = RmRebootReasonSessionMismatch and bRestartable = FALSE
other results:(B run with elevated privileges)
A & B is a console and in the same session:lpdwRebootReasons = RmRebootReasonNone, bRestartable = TRUE, ApplicationType = RmConsole.
A & B is a console and in the different session:lpdwRebootReasons = RmRebootReasonSessionMismatch, bRestartable = FALSE, ApplicationType = RmConsole.
A: service, B: console: lpdwRebootReasons = RmRebootReasonNone, bRestartable = TRUE, ApplicationType = RmService
(B not run with elevated privileges):
A & B is a console and in the different session:lpdwRebootReasons = RmRebootReasonCriticalProcess, bRestartable = FALSE, ApplicationType = RmCritical.
A: service, B: console: lpdwRebootReasons = RmRebootReasonPermissionDenied, bRestartable = FALSE, ApplicationType = RmCritical
According the document bRestartable depends on ApplicationType. And then, we can see that if the bRestartable = TRUE, then the lpdwRebootReasons = RmRebootReasonNone. But when bRestartable = FALSE, It depends on the other members RM_PROCESS_INFO.
A Clue from the RestartManager PowerShell Module
The RestartManager PowerShell module (special thanks to Heath Stewart) provides a simple PowerShell interface for the Restart Manager. My commands are as follows:
Set-Location <path to Cygwin root directory>
Start-RestartManagerSession
Get-ChildItem . -File -Include *.exe,*.dll -Recurse | RegisterRestartManagerResource
Get-RestartManagerProcess
Stop-RestartManagerProcess
These commands produce the following output:
Id : <process ID>
StartTime : <process start time>
Description : <executable started by cygrunsrv>
ServiceName :
ApplicationType : Console
ApplicationStatus : Running
IsRestartable : False
RebootReason : SessionMismatch
Id : <cygrunsrv process id>
StartTime : <cygrunsrv process start time>
Description : <description of service>
ServiceName : <service name>
ApplicationType : Service
ApplicationStatus : Running
IsRestartable : True
RebootReason : SessionMismatch
For some reason, Restart Manager sees the cygrunsrv.exe service process as restartable, but the executable it spawns as not restartable. (I am still curious about why this happens in the first place.)
An Imperfect Workaround Attempt
Based on this observed behavior, I first attempted the following workaround:
In the Inno Setup script's [Setup] section, set the following:
CloseApplications=yes
CloseApplicationsFilter=*.chm,*.pdf
RestartApplications=yes
The CloseApplicationsFilter directive specifies what files get registered with the Restart Manager. Note I do not specify *.exe or *.dll here; I want to manually specify only certain .exe files in the [Code] section.
Call the Inno Setup RegisterExtraCloseApplicationsResource function once for each .exe file in the setup that will NOT be spawned by cygrunsrv and put them in the RegisterExtraCloseApplicationsResources event procedure. Example:
[Code]
procedure RegisterExtraCloseApplicationsResources();
begin
RegisterExtraCloseApplicationsResource(false, ExpandConstant('{app}\bin\cygrunsrv.exe'));
end;
It's important not to register any executable spawned by cygrunsrv.exe or any of the Cygwin DLL files, because this will prevent the Restart Manager from taking effect in Inno Setup.
This solution is far from perfect, because executables normally started by cygrunsrv, if started separately, are not detected by Restart Manager (e.g., sshd.exe). For example, new SSH sessions are spawned in executables that the Restart Manager are not restartable.
A Better Solution
I've decided that a better solution is to detect any running executables from code and prompt the user apart from the Restart Manager functionality (which, simply put, doesn't work for Cygwin services).
I've built a complex Shiny interface that pulls from an internally networked ODBC table and allows a user to interact with the data through their browser. The company is on Windows 7 Enterprise and IT only supports IE 9. Some users have chrome installed in their user folders, some have firefox, some use IE 9. I followed a tutorial from R-Bloggers (here: http://www.r-bloggers.com/deploying-desktop-apps-with-r/) and it runs on my machine using a portable Chrome browser downloaded from PortableApps.com. Great. Unfortunately the interface has not started on ANYONE else's machine that has their own local Chrome browser installed.
Following the tutorial, I use the following vb script:
Rexe = "R-Portable\App\R-Portable\bin\Rscript.exe"
Ropts = "--no-save --no-environ --no-init-file --no-restore --no-Rconsole"
RScriptFile = "runShinyApp.R"
Outfile = "ShinyApp.log"
strCommand = Rexe & " " & Ropts & " " & RScriptFile & " 1> " & Outfile & " 2>&1"
intWindowStyle = 0 ' Hide the window and activate another window.'
bWaitOnReturn = False ' continue running script after launching R '
CreateObject("Wscript.Shell").Run strCommand, intWindowStyle, bWaitOnReturn
This script calls the following code in my R file:
message('library paths:\n', paste('... ', .libPaths(), sep='', collapse='\n'))
chrome.portable = file.path(getwd(),'GoogleChromePortable/App/Chrome-bin/chrome.exe')
launch.browser = function(appUrl, browser.path=chrome.portable) {
message('Browser path: ', browser.path)
shell(sprintf('"%s" --app=%s', browser.path, appUrl))
}
shiny::runApp('shiny', launch.browser=launch.browser)
It works on my computer just fine... I DO have chrome installed locally, but I'm calling the Portable Chrome executable. It worries me that the two are sharing prefs or something, e.g. I notice that a hash from the Preferences file in my installed version, specifically:
"chrome_url_overrides": {
"bookmarks": [ "chrome-extension://eemcgdkfndhakfknompkggombfjjjeno/main.html" ]
},
...matches the same json entry from the Portable Chrome installation:
"chrome_url_overrides": {
"bookmarks": [ "chrome-extension://eemcgdkfndhakfknompkggombfjjjeno/main.html" ]
}
Why do these long random strings match? Am I barking up the wrong tree for wondering about this? I don't know why these strings match if they are two separate installations of Chrome executables, one of which is supposed to run completely independently from anything on the machine.
Here's a set of errors from one machine:
.../Desktop/TestApp3/GoogleChromePortable/App/Chrome-bin/chrome.exe[9100:9408:0716/141934:ERROR:gpu_info_collector_win.cc(103)] Can't retrieve a valid WinSAT assessment.
[9100:9408:0716/141934:ERROR:component_loader.cc(138)] Failed to parse extension manifest.
[9100:1716:0716/141946:ERROR:get_updates_processor.cc(214)] PostClientToServerMessage() failed during GetUpdates
Here's a set of errors from a second machine:
.../Documents/TestApp3/GoogleChromePortable/App/Chrome-bin/chrome.exe
[5220:3384:0714/142128:ERROR:component_loader.cc(138)] Failed to parse extension manifest.
[5220:7600:0714/142130:ERROR:external_registry_loader_win.cc(136)] File C:\Program Files\Coupons.com CouponBar\chrome\Coupons.com.crx for key
Software\Google\Chrome\Extensions\cnpkmcjgpcihgfnkcjapiaabbbplkcmf does not exist or is not readable.
[5220:2120:0714/142140:ERROR:get_updates_processor.cc(214)] PostClientToServerMessage() failed during GetUpdates
[5220:3384:0714/142413:ERROR:CONSOLE(122)] "Could not find value for secondaryUser", source: chrome://resources/js/load_time_data.js (122)
[5220:3384:0714/142413:ERROR:CONSOLE(122)] "[undefined] (secondaryUser) is not a boolean", source: chrome://resources/js/load_time_data.js (122)
[5220:3384:0714/142425:ERROR:CONSOLE(122)] "Could not find value for secondaryUser", source: chrome://resources/js/load_time_data.js (122)
[5220:3384:0714/142425:ERROR:CONSOLE(122)] "[undefined] (secondaryUser) is not a boolean", source: chrome://resources/js/load_time_data.js (122)
[5220:3384:0714/142442:ERROR:navigation_entry_screenshot_manager.cc(167)] Invalid entry with unique id: 12
It seems like Chrome is doing different things on different computers and is not actually acting as a standalone browser... but likely interacting with the browser installed on their respective computers via the registry or some other "under the hood, active" communication. Maybe, since I installed the portable executable on my machine, a bunch of my local extensions or preferences were automatically updated to the portable's preferences, etc. and subsequently this is causing a conflict on every other machine??
Can I shutdown Chrome's extensions or extra functions like the calls to the updater? Is there a better standalone portable browser that functions well with Shiny for this type of "deployment" purpose? Can I fix this or is this a lost cause?? This should be obvious but I'll say it anyway: it is definitely not economically efficient to ask the non-technical types to install R, then RStudio, then confirm their working directory structure, then call the runApp() command via the Script window...
I started with those same articles, but developed the RInno package to solve this exact problem, i.e. when you want to share your desktop Shiny app with non-technical users who can't be expected to mess around with all those details.
To get started:
install.packages("RInno")
require(RInno)
RInno::install_inno()
Then you just need to call two functions to create an installation framework:
create_app(app_name = "myapp", app_dir = "path/to/myapp")
compile_iss()
This will create an installation wizard that runs like any other program, but installs your shiny app on a Windows desktop computer. If you would like to include R for your co-workers who don't have it installed, add include_R = TRUE to create_app:
create_app(app_name = "myapp", app_dir = "path/to/myapp", include_R = TRUE)
It defaults to include shiny, magrittr and jsonlite, so if you are using other packages like ggplot2 or plotly, just add them to the pkgs argument. You can also include GitHub packages to the remotes argument:
create_app(
app_name = "myapp",
app_dir = "path/to/myapp"
pkgs = c("shiny", "jsonlite", "magrittr", "plotly", "ggplot2"),
remotes = c("talgalili/installr", "daattali/shinyjs"))
If you are interested in other features, check out FI Labs - RInno
I'm making changes to a website written in classic asp.
My system is a Windows 7 64-bit.
I've been able to get the website to run, after setting it up as a classic asp running on IIS6.
When it attempts to execute the following code, I get the permission denied error:
from1 = "Kevin#company.com"
to1 = "staff1#company.com"
to2 = "staff2#company.net"
to3 = "staff3#client.com"
strTo = to1
If Len(strTo) > 0 Then
If Len(to2) > 0 Then
strTo = strTo & ";" & to2
End If
Else
strTo = to2
End If
If Len(strTo) > 0 Then
If Len(to3) > 0 Then
strTo = strTo & ";" & to3
End If
Else
strTo = to3
End If
body = reqApprName & "<br />" & reqApprPhone & "<br />" & reqApprEmail & "<br />Loan Number: "_
& loannum & "<br /><br />Please do not reply back to this email. The Vendor has provided the following "_
& "comment associated with this order.<br /><br />" & reqUndueInfluenceComment
Set ObjMail = CreateObject("CDONTS.Newmail")
ObjMail.From = from1
ObjMail.To = strTo
ObjMail.Subject = "Appraisal Order "&OrderNum&" by Vendor"
ObjMail.BodyFormat = 0
ObjMail.MailFormat = 0
ObjMail.Body = body
ObjMail.Send
Set ObjMail = Nothing
I'm puzzled, since I've never had a problem with CDONTS before. Then again, I've never tried using it on a Windows 7 64 bit machine, using 32 bit classic asp.
Does anyone have any ideas?
Thanks, all.
PS: I get the error on the create object for CDONTS.NewMail
When you try to send a message, you may receive the following error message:
Microsoft VBScript runtime error '800a0046' Permission denied
This problem occurs when an application is run out-of-process in IIS.
When this problem occurs, the user context of the process changes from the IUSR_MachineName account that does have access to the IIS metabase to the IWAM_MachineName account that does not have access to the IIS metabase.
Typically, this error has two causes.
Cause 1
The user under whom the .asp page is running or the script is running does not have permissions to the Pickup directory.
Typically, the Pickup directory is found in the following locations:
For computers that are running IIS only:
C:\Inetpub\Mailroot\Pickup
For computers that are running Microsoft Exchange 5.5:
Exchsrvr\Mailroot\Pickup
For computers that are running Exchange 2000:
\Program files\Exchsrvr\Mailroot\Vsi #\Pickup
Solution
The user under whom the .asp page is running or the script is running must have Modify (Change) permission to the Pickup directory so that the NewMail object can create the .eml file.
Cause 2
The page is running in its own memory space and is being denied access to the IIS metabase. To verify this, follow these steps:
Click Start, click Run, type Inetmgr, and then click OK.
Right-click either the root directory or the virtual directory that contains your page, and then click Properties.
If you right-clicked the root directory in step 2, click the Home Directory tab.
If you right-clicked the virtual directory in step 2, click the Virtual Directory tab.
On a computer that is running Windows NT, determine whether the Run in separate memory space check box is checked.
If the Run in separate memory space check box is checked, click to clear the check box. Alternatively, on the Properties menu of the SMTP service, click the Operators tab, and then add the IWAM_MachineName account.
On a computer that is running Windows 2000, determine whether the Application Protection setting is set to High (Isolated). If the Application Protection setting is set to High (Isolated), set the Application Protection setting to Medium (Pooled). Alternatively, on the Properties menu of the SMTP service, click the Security tab, and then add the IWAM_MachineName account to the Operators account.
Support.Microsoft.com
I created a VB script that converts the Object Repository file (.tsr) of QTP to XML and then to Excel. This Excel file format is configured via the VB script as well. It works well however, I am trying to run this on a new machine and I get an error:
ActiveX component cant create object: Mercury.ObjectRepositoryUtil.
Script:
Public Function ExportTSRToXML(TSRPath,XMLPath)
Set XMLRepositoryObj = CreateObject("Mercury.ObjectRepositoryUtil")
XMLRepositoryObj.ExportToXML TSRPath, XMLPath
ExportTSRToXML = XMLPath
Set XMLRepositoryObj = Nothing
End Function
Here are my steps to fix this:
1. Registered RepositoryUtil.dll with REGSVR32
2.using CSCRIPT.exe under SYSWOW64 ran the vbscript file
At step 2 mentioned above, I see the error when the script is executed :
"Microsoft VBScript runtime error: invalid procedure call or argument"
What Am i missing? Cant figure it out.
Thank you for your help. Again, this code works completely fine on multiple machines. The new Machine (64bit) has Unified Functional tool 11.5 instead of QTP 11.0.
Try to start the script from command line with: %SystemRoot%\SysWow64\cscript <yourscript-here>.
The 64 bit machine automatically starts a 64 bit interpreter and this com object is not compatible with it
I have a service to download file using credential domain\user but get this error :
ErrorCode [-2147023582] 80070522
Description [A required privilege is not held by the client.]
ErrorContext [RemoteFileError]
at Windows Server 2003 64 bits
I'm setting credential so :
bc.AuthenticationScheme = AuthenticationScheme.Negotiate;
bc.AuthenticationTarget = AuthenticationTarget.Server;
The user has full access rights on source and destination folders.
Using SharpBits library.
It seems to be missing some right of access yet. Any suggestions?
[EDIT]
It seems that there is some failure in resource access provided by the BITS service.
Still investigating.
[EDIT]
Investigating the rights to use BITS.
-with the command "sc sdshow bits" I get this output on the environment where it works :
D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)
(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)
(A;;CCLCSWLOCRRC;;;AU)(A;;CCLCSWRPWPDTLOCRRC;;;PU)
S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)
-where the copy does not work :
D:(A;;CCLCSWRPWPDTLOCRRC;;;SY)
(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)
(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)
(A;;CR;;;AU)
(A;;CCLCSWRPWPDTLOCRRC;;;PU)
S:(AU;FA;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;WD)
The solution : added the user "NT AUTHORITY\NETWORK" permissions to read at folders in all remote hosts.
That's it.