Start-BitsTransfer doesn't work with winRM protocol - powershell

Hy,
I try to launch Start-BitsTransfer command with a Rundeck Job.
I have the error : The remote use of BITS is not supported.
I launch some powershell commands with succes.
Thanks

I used wget command.
But it works with a little item. When I try to download a big item (3Go) I have this error : com.xebialabs.overthere.cifs.winrm.WinRmRuntimeIOException : Unexpected HTTP response ..
I have create a new Question

Related

Ignore popup windows when executing powershell script Request-Certificate.ps1

In order to request a User ceritificate I'm using the script provided by the Powershell gallery https://www.powershellgallery.com/packages/Request-Certificate/1.5.0/Content/Request-Certificate.ps1
To execute this script I'm using the following command:
. "C:\Certificates\RequestCertificate.ps1" -CN "User Common Name" -TemplateName "User" -CAName "domain\CAserver" -Export
However when I run this command here is the output:
After this output I get a popup message with the following information:
Machine context template conflicts with user context.
If I click ok, the request is concludes successfully. However I'm trying to automate this process. Is there a way to ignore the popup window?
I already looked at the question How to suppress a popup window while using certreq to request a certificate from an enterprise CA? (How to suppress a popup window while using certreq to request a certificate from an enterprise CA?). However the solution for the problem described was to run the script as Admin or System because the certificate generated was for the Machine and not for the User.
Does anyone know why this is happening?
Thank you in advance

PowerShell runs Invoke-WebRequest instead of curl [duplicate]

I'm new to cURL, just got it installed but it seems to only do what it feels like. I'm using the 64 bit version I got from here: http://curl.haxx.se/latest.cgi?curl=win64-ssl-sspi with installation instructions I found here: http://guides.instructure.com/m/4214/l/83393-how-do-i-install-and-use-curl-on-a-windows-machine. Opening a new Powershell window I'm able to use a simple GET request like so:
curl http://localhost:3000
but if I run a POST
curl -d "hello world" http://localhost:3000
it tells me "Invoke-WebRequest : Parameter cannot be processed because the parameter name 'd' is ambiguous. Possible matches include: -DisableKeepAlive -Debug."
Trying to get help I type
curl -h or curl --help
gives me "Invoke-WebRequest : Missing an argument for parameter 'Headers'. Specify a parameter of type 'System.Collections.IDictionary' and try again."
As I mentioned, I'm a cURL newbie but it seems strange that it can do get requests but nothing else. Any ideas what I'm doing wrong?
Windows 7 64 bit
Powershell version 4
Your problem is that your are not using the Curl you installed but a CmdLet called Invoke-WebRequest.
Just execute :
Remove-item alias:curl
And test your curl again, then store it in your profile.
The explanation is that it exists a native alias to the Invoke-WebRequest which is a CmdLet that is supposed to deliver a kind of curl service.
From Windows 10 build 17063 and later (April 2018), Curl is included into Windows, so that you can execute it directly from Cmd.exe or PowerShell.exe. To use it in PowerShell be careful to unalias this CmdLet or explicitly call curl.exe.
Built with Schannel (Microsoft's native TLS engine), libcurl still perform peer certificate verification, but instead of using a CA cert bundle, it uses the certificates that are built into the OS.
You can execute curl commands with Command Prompt instead of Windows Powershell. Command prompt doesn't alias curl commands like Windows Powershell does.
To open command prompt, hit Win + R, type cmd in the input box, <Enter>.

Rundeck - Move Hyper-V VM throught Powershell

I'm new to Rundeck.
I succeed to launch SSH commands on my linux servers, CMD and Powershell on my Windows VM or Host.
But !
But, I can't launch this kind of commands to move my MV from one host to another :
Command : Move-VM "SRV12-XXX" srv-hypervisor2 -IncludeStorage -DestinationStoragePath D:\Hyper-V\SRV12-XXX
I get this kind of error :
The remote commection fail with the following error message :
An error has occurred which Windows PowerShell cannot handle. A remote session might have ended.
Do you know how I can make it works ?
When I run the below command to know if I'm looged "as admin" an answer is true :
(New-Object Security.Principal.WindowsPrincipal([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
Thanks in advance for you help.
Cédric

Start-Process : The system cannot find the file specified from TeamCity Build step but works fine locally

i am trying to run Pact broker can i deploy tool with paramaters which is working fine locally but when i add the build step in TeamCity it is throwing below error
Start-Process : This command cannot be run due to the error: The
system cannot find the file specified.
when i run the same powershell script locally, it is working fine .
powershell script:
CanIDeploy.bat code is
Note: the reason i am calling pact-broker.bat from power shell script is, unable to run bat file from Teamcity , that is the reason created powershell script which internally calls pact broker bat file.
any help is appreciated
I see that you use relative path, but what about the working directory? I see a different path in the error message vs what you show where the file is.

Error in executing powershell script SQL Server

I have a powershell script that am running but it keeps getting errors. Please see below:
Invoke-Sqlcmd : Could not load file or assembly 'Microsoft.SqlServer.BatchParser.dll' or one of its dependencies
How can I fix this problem?
I have checked online for solution but could not get any help
I got solution from this page:
https://social.technet.microsoft.com/wiki/contents/articles/35832.sql-server-troubleshooting-could-not-load-file-or-assembly-microsoft-sqlserver-batchparser.aspx