im trying to use psexec.exe in powershell, but appear connect but do not nothing. Supposedly i call psexec in his route in my computer, with the parameters i usually use in a normal CMD.
C:\c\PsExec.exe \\Hostname.domain.CORP -u domain\admx097168 -p Password cmd -c “c:\temp\hola.vbs”
This is the response on the console.
PS C:\Users\x097168> C:\Consola\testmasiveSCCM.ps1
C:\c\PsExec.exe :
En C:\Consola\testmasiveSCCM.ps1: 2 Carácter: 1
+ C:\c\PsExec.exe \\Hostname.domain.CORP -u domain\admx097 ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
Microsoft Windows [Versi¢n 10.0.10240]
(c) 2015 Microsoft Corporation. Todos los derechos reservados.
appear still working, but do nothing, will be necessary stopped the scripting to continue.
Anyone can help me? first of all, thank you very much for reading my query.
one last thing, i can't use invoke-command, cause is forbidden in my domain.
at finally i can do it with the next secuence.
C:\c\PsExec.exe \xxx.xx.xx.xxx -u prbes\admx000000 -p Pasw0rd -i -d cscript.exe c:\temp\test.vbs
Related
when i type command at windows terminal http-server following error occured
error
http-server
http-server : File C:\Users\RKanth\AppData\Roaming\npm\http-server.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ http-server
+ ~~~~~~~~~~~
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
Open PowerShell by Run as Administrator
Run the following command:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
Confirm with ‘Y’
Open PowerShell by Running as Administrator using the windows search bar.
Run the following command: Get-ExecutionPolicy
Then you can See: Restricted
Again run the following command: Set-ExecutionPolicy Unrestrict
Press y
Now you can Run again the following command and check: Get-ExecutionPolicy
Then you can See: Unrestricted
Done!!!
I have been trying to run a flume agent on my windows system to get twitter data. I am following this blog
https://acadgild.com/blog/streaming-twitter-data-using-flume
But, whenever i try to run the flume agent I get the follwing error -
flume-ng agent -n TwitterAgent -f ./conf/flume.conf
E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin\bin>powershell.exe -NoProfile -InputFormat none -ExecutionPolicy unrestricted -File E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin\bin\flume-ng.ps1 agent -n TwitterAgent -f ./conf/flume.conf
Resolve-Path : Cannot find path 'E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin\bin\conf\flume.conf' because it does not exist.
At E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin\bin\flume-ng.ps1:217 char:24 + $confFile = '"' + (Resolve-Path $confFile).Path + '"' + ~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (E:\apache-flume...conf\flume.conf:String) [Resolve-Path], ItemNotFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.ResolvePathCommand
I have tried debugging it on my own, but have failed to do so. I tried to look for this particular error but could not find it anywhere.
Does E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin\bin\conf\flume.conf exist at that location? Are you sure it's in \bin\conf\flume.conf and not \conf\flume.conf? In which case use:
flume-ng agent -n TwitterAgent -f ./../conf/flume.conf
Or (as is more common), run from the E:\apache-flume-1.7.0-bin\apache-flume-1.7.0-bin folder with the command:
bin/flume-ng agent -n TwitterAgent -f ./conf/flume.conf
After some research I found the solution to append the output of a sqlcmd command to a csv file. Everything is fine when using the Command Shell:
C:\temp>sqlcmd -S <SERVER> -d <DATABASE> -E -Q "SELECT [something] FROM [TableX] WHERE [columnY] IS NOT NULL;" -W -h-1 -s";" >>"<FULL_PATH_TO_CSV-FILE>"
I want to schedule this stuff by using SQL Server Job Agent (with same account as with console) so I add a Job (type CmdExec). Job execution fails with the following error (unexpected argument):
Meldung
Ausgeführt als Benutzer: ''[ACCOUNT]''. Sqlcmd: '>>''[FULL_PATH_TO_CSV-FILE]'': Unerwartetes Argument. Geben Sie '-?' ein, um die Hilfe anzuzeigen. Prozessexitcode 1. Fehler bei Schritt.
My workaround works fine: remove >>"<FULL_PATH_TO_CSV-FILE>" and use the output file of the step. But: I want to use the output file for logging purposes - not for the data output ...
The question is: why does the ">>" command does not work within a SQL Server Agent job?
I don't want to simply redirect the output. I know that sqlcmd provides the parameter -o for that. In this case an existing file would be overwritten. That's not what I want.
Unfortunatelly I do not have the reputation to post the screenshots so far.
Thanks you very much in advance!
Best regards,
D.C.
I think the issue here that SQL server agent creates process "sqlcmd" and sends this whole line to it as a parameters. So "sqlcmd" doesn't know what this means - ">>..." and returns with error.
To use this (">>") Command Shell syntax you should call it in the SQL agent. So try:
cmd.exe /c "sqlcmd -S -d -E -Q "SELECT [something] FROM [TableX] WHERE [columnY] IS NOT NULL;" -W -h-1 -s";" >>"""
Following the steps on the page: http://dotnet.github.io/core/getting-started/ on an elevated PowerShell console (Windows 10):
&{$Branch='dev';iex ((New-Object Net.WebClient).DownloadString('https://raw.githubusercontent.com/aspnet/Home/dev/dnvminstall.ps1'))}
downloads and installs correctly.
dnvm install -r coreclr latest -u
returns error:
Determining latest version
Unable to find any runtime packages on the feed!
At C:\Users\softw\.dnx\bin\dnvm.ps1:552 char:9
+ throw "Unable to find any runtime packages on the feed!"
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : OperationStopped: (Unable to find ...es on the feed!:String) [], RuntimeException
+ FullyQualifiedErrorId : Unable to find any runtime packages on the feed!
I managed to get it working by running dmvm list and following the offer to install dmx.
Was I doing something wrong or is the documentation out of date?
Just remove latest from your command:
dnvm install -r coreclr -u
Remove -u if you want the latest stable bits. -u means unstable/dev feed.
I am using psexec(with MSbuild Script) to run an xCopy on a server from Jenkins(Hudson). The command runs ok when run through Command Prompt(as System user), but gives the following error when tried using Jenkins. This is the command I am using from Msbuild script:
psexec \\<RemoteMachine> /accepteula -i -u <Domian\User> -p <Pass> -s cmd /c xcopy <Path1> <Path2> /e /i
PsExec v1.98 - Execute processes remotely
Copyright (C) 2001-2010 Mark Russinovich
Sysinternals - www.sysinternals.com
The handle is invalid.
Connecting to ..
Couldn't access :
Connecting to ...
**error MSB3073: The command "psexec \\<RemoteMachine> /accepteula -i -u <Domian\User> -p <Pass> -s cmd /c xcopy <Path1> <Path2> /e /i " exited with code 6.**
I have tried too many options but no luck so far.
Does anyone tried the same using Jenkins? Help will be really appreciated.
Are there any other ways to achieve this using some other tools without any problem. Please share.
Just wanted to post the solution here, as I figured it after some time.
The Remote Machine should have this user added in the Administrators Group.
This will resolve the connection issue. :)