"Insufficient memory to continue the execution of the program" when scraping website - powershell

I am trying to scrape a website with PowerShell on Windows 10.
I can get a full list of attributes on the site by calling $ie.document, but when I try to call $ie.document.getElementById("a-button") I get the following message:
Insufficient memory to continue the execution of the program.
I haven't had any luck finding a solution for this. Any ideas ?

Related

The remote name could not be resolved: '*****.sharepoint.com' in O365 Online Sharepoint in Powershell

I am uploading files from a specific drive in the host computer to a Sharepoint Site, for this I have used Microsoft.SharePoint.Client.dll & Microsoft.SharePoint.Client.Runtime.dll. Most of the times my script works fine, but at times I get the error:
"Failed to connect to SharePoint Online site: 'https://XXX.sharepoint.com/sites/XXX'"
"Exception Type: System.Management.Automation.MethodInvocationException"
"Exception Message: Exception calling ""ExecuteQuery"" with ""0"" argument(s): ""The remote name could not be resolved: 'XXX.sharepoint.com'"""
Any ideas of what might be causing the error and how I could prevent the script from crashing again?
Thank you!
As most of the times, the script works.
I assuming that it could be some network issue in your side.
Did you use some proxy in you side and can you access the site url in browser directly ?
I suggest you can trace the request using Fiddler to see if there is some detailed error message when executing the script:
Fiddler

How to control window AD with rundeck

I'm looking for the best solution for automating Windows server 2012r2 via Rundeck. I'm extremely familiar with Rundeck but use it for linux vms. I've searched online for this topic but havent found anything that seems reliable. Ideally, I want to start a Runeck Job that can add users in Active Directory but not sure how to approach it. I've tried using winrm but have gotten mixed results. Ironically, it will run basic powershell commands but it errors when trying to do anything with AD. Ive even tried creating a powershell script on the AD server and have Rundeck simply execute the powershell script to no avail. Hopefully someone has had success in controlling windows nodes with Rundeck. Below is the error i receive when trying to run a powershell script.
Execution failed: 27 in project windows: [Workflow result: , step failures: {1=Dispatch failed on 1 nodes: [Windows_AD_Server: NonZeroResultCode: [WinRMPython] Result code: 1 + {dataContext=MultiDataContextImpl(map={ContextView(node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}, ContextView(step:1, node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}}, base=null)} ]}, Node failures: {Windows_AD_Server=[NonZeroResultCode: [WinRMPython] Result code: 1 + {dataContext=MultiDataContextImpl(map={ContextView(node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}, ContextView(step:1, node:Windows_AD_Server)=BaseDataContext{{exec={exitCode=1}}}}, base=null)} ]}, status: failed]
Firstly, PowerShell already offers a built-in way to execute jobs, with no 3rd party addons.
About Jobs
Provides information about how PowerShell background jobs run a command or expression in the background without interacting with the current session.
About Remote Jobs
Describes how to run background jobs on remote computers.
PowerShell Jobs Week: Remote Jobs
I've never heard of / used Rundeck as Paul points out as well, so this just be the Rundeck has particulars that need to be in play first. Yet, looking at the docs, and a quick youtube video on the topic, there are several things that must be in place for what you say here...
I've tried using winrm but have gotten mixed results.
… to work.
Video - Running commands remotely using the console with WinRM/WinRS
If Rundeck is similar to SCCM or Scheduled Task, then the same approach applies.
Write Your PowerShell script. have Rundeck/ScheduedTask call powershell.exe to run the script
How to execute a PowerShell script automatically using Windows task scheduler?
Also, this could very well be seen as a duplicate of this stackoverflow discussion and answer.
rundeck unable to execute powershell script with import-module
I am setting up somethin similar and have the same problem. The AD operation executes successfully, but returns exit code 1 and throw the error you mentioned. I am in the process of debugging the plugin, but it seems there is a bug within response handling.
Please check if the ad operation works although the error is thrown and please post the script block you are using to control the AD.
Edit: in meantime I was able to narrow down the issue and opened an issue with the project: github
I provisionally fixed the issue with adding the following line in winrm-session.py after line 89:
new_msg = msg
The line before is:
" error message: %s" % (e))
The line after is:
else:
If this does not solve your issue, please post your script block.
Best Tobias

failed using cuda-gdb to launch program with CUPTI calls

I'm having this weird issue: I have a program that uses CUPTI callbackAPI to monitor the kernels in the program. It runs well when it's directly launched; but when I put it under cuda-gdb and run, it failed with the following error:
error: function cuptiSubscribe(&subscriber, CUpti_CallbackFunc)my_callback, NULL) failed with error CUPTI_ERROR_NOT_INITIALIZED
I've tried all examples in CUPTI/samples and concluded that programs that use callbackAPI and activityAPI will fail under cuda-gdb. (They are all well-behaved without cuda-gdb) But the fail reason differs:
If I have calls from activityAPI, then once run it under cuda-gdb, it'll hang for a minute then exit with error:
The CUDA driver has hit an internal error. Error code: 0x100ff00000001c Further execution or debugging is unreliable. Please ensure that your temporary directory is mounted with write and exec permissions.
If I have calls from callbackAPI like my own program, then it'll fail out much sooner with the same error:
CUPTI_ERROR_NOT_INITIALIZED
Any experience on this kinda issue? I really appreciate that!
According to NVIDIA forum posting here and also referred to here, the CUDA "tools" must be used uniquely. These tools include:
CUPTI
any profiler
cuda-memcheck
a debugger
Only one of these can be "in use" on a code at a time. It should be fairly easy for developers to use a profiler, or cuda-memcheck, or a debugger independently, but a possible takeaway for those using CUPTI, who also wish to be able to use another CUDA "tool" on the same code, would be to provide a coding method to be able to disable CUPTI use in their application, when they wish to use another tool.

Access Denied Error when issuing Install-AzureWinRMCertificate

I have been working diligently to get Dynamics Installed on Azure, I have made it a good way through the Example-1VM.ps1 before encountering a failure to 'Install-AzureWinRMCertificate' error message indicating access denied.  The error is coming while running the PowerShell script 'New-NAVAdminSession.ps1'  I can see from looking in Azure, much of the work has been done properly from the Example-1VM.ps1 file, but I'm not sure what is next,  Can I manually install the certificate and if so may I know how?  If not, how do I correct this so I can re-run the Example-1VM.ps1 script.
Thanks to Walter slapping me upside the head (kindly of course) to double check if I was running PowerShell ISE as Administrator I was able to get this resolved.
Once I exited PowerShell ISE and re-entered the desktop application with the option 'run as Administrator' all worked fine.
Just goes to show sometimes we are too close to our own problems.
Cheers Walter
According to your error log, it seems a permission issue. Please close your PowerShell and run PowerShell Run as Administrator.

Server logs: Looking for endless redirect Loop

One of my Drupal websites homepage (just the homepage) is constantly redirecting when the site is visited. Tends to happen randomly. Which I don't understand why it would do this. I talked a bit on the Drupal community and it is said to be a server issue. Not Drupal.
Error 310 (net::ERR_TOO_MANY_REDIRECTS): There were too many redirects.
I don't currently have CPanel access to check the server logs though. I am somewhat fluent in terminal and I have root SSH access to the server.
Where and what commands would I have to run to find and access the logs that could possible help me figure where to start with fixing this? Would they just be located in /var/? What would I be looking for once I get access to the logs, just a steady stream of the duplicated IP address that it keeps being redirected too?
Found out this IS a Drupal Commerce Kickstart core issue.
Found follow errors in php logs:
PHP Warning: Unknown: Input variables exceeded 1000. To increase the limit change max_input_vars in php.ini
PHP Fatal error: Unsupported operand types in public_html/dev/profiles/commerce_kickstart/modules/contrib/search_api_db/servic‌​e.inc on line 970
Got the redirect loop to stop after increasing the max_input_vars to 9000. I feel it's more of a bandaid fix though. So I'm taking this further into the Commerice Kickstart community.