The remote name could not be resolved: '*****.sharepoint.com' in O365 Online Sharepoint in Powershell - 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

Related

using exchange powershell - cannot determine the content type of the HTTP response

I have a C# console app that I wrote that is trying to enable mail for an AD user.
using (Runspace EnableMailboxRunspace = RunspaceFactory.CreateRunspace(ConnectionInfo(ExchangeServerURI, ExchangeUser, ExchangePassword)))
{
EnableMailboxRunspace.Open();
// Create a pipeline to process the commands
using (Pipeline EnableMailboxPipeline = EnableMailboxRunspace.CreatePipeline())
This works just fine in the dev environment, but I cannot get it to run on any production server. When the CreatePipeline command is executed I get this error:
"Connecting to remote server pc799.csnt.princegeorge.ca failed with
the following error message : The WinRM client cannot process the
request. It cannot determine the content type of the HTTP response
from the destination computer. The content type is absent or invalid.
For more information, see the about_Remote_Troubleshooting Help
topic."
I have tried this running as multiple different users, including domain admins.
This app did work a few months ago, but now it doesn't work. We moved from a fully on prem system, to a hybrid M365/On prem system and something in that seems to have broke it.

NuGet gives me an error when accessing server

We have set up a small NuGet server in our corporate network. It works fine for EVRYONE except me ;-)
When I try to list the available packages in Visual Studio, all I get is this error message:
Unable to load the service index for source (...).
An error occurre while sending the request.
The remote server returned an error: (502) Bad Gateway.
I've been struggeling with this issue for hours without success. Can anyone give me a hint on why this error occurs?

Unable to invoke web-request for script called in scheduled task for service account

We have a Powershell script which downloads some zip files from a website and we have called the script in a scheduled task.
The problem is we are not getting the zip files even after the scheduled task is finished successfully. We are using a service account for that. Running the script manually downloads the zip file without any issues. Also, for another user which we use to login into the server, the task is working fine.
The issue started after our service account got locked out because of too many failed attempts in some other system.
I have tried bypassing the execution policy but no luck.
I have tried creating a similar new task but no luck.
I tried Start-in option to provide the task the location of the script but no luck.
After too much troubleshooting, I found the error in the Powershell logs in Event Viewer. Please find the error below:
Error Message = Unable to connect to the remote server
Fully Qualified Error ID = WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
This shows that the task is unable to invoke the web request. Can this be a permission issue? If yes, then how can I provide the required access?
I troubleshooted a bit more and found that the issue is with the proxy. Can somebody tell me how can I resolve this issue? For the local user it is working fine. Even I am able to access the webpage manually through IE. Shall I import proxy settings from IE? If yes then how to do that?
I finally figured out the solution for this. I added proxy details in the script which will force the Invoke web request command to send the request to that proxy server. This thing has resolved my issue.
Regards,
Mitesh Agrawal

SSIS Redirect Request Failed Error

I have an SSIS package that calls an SSRS report hosted on a local server that produces a series of PDFs. It has been working perfectly for months, but all of the sudden I am now getting this error:
Error: 0xC001600B at SSIS_Package, Connection manager "ReportServer": The specified server, URL http://server/report&parameter1=401&parameter2=13&rs:Command=Render&rs:Format=PDF, has a redirect and the redirect request failed.
I have checked all my credentials in the package and on the server and everything is connected properly. I haven't been able to find anything at all about this error and I'm hoping someone out there has come across it!
It turned out to be a permissions error that was resolved by another user running the package.

Unable to connect to the remote server - Facebook Api

I am currently developing an application that uses the facebook api to get the posts from my feed.
I tested it locally using Visual Studio 2013 and it works just fine !
But when I publish it at IIS 7 it doesnt work.. it throws an exception while invoking the method Get of Facebook Client.
This is the error:
Exception Message: Unable to connect to the remote server
StackTrace of exception:
at Facebook.HttpHelper.OpenRead()
at Facebook.FacebookClient.Api(HttpMethod httpMethod, String path, Object parameters, Type resultType)
at Facebook.FacebookClient.Get(String path, Object parameters, Type resultType)
at FacebookProxy.WebUI.Default.LoadPosts(ControlCollection container, String upperPostId)
Maybe I need some special configuration on the IIS?
Thanks alot in advance
EDIT: I managed to attach the process to debug while launching the website from the IIS, and this was the inner exception message:
Inner Exception: No connection could be made because the target machine actively refused it 31.13.64.113:443
This only occurs while launching from my local IIS why? I already disabled all Firewall
solved, error on proxy. I need to open port at my network