I have a powershell script that pulls in a server list with the following headers. computername,optype,opname. I then loop through and if I have a format of server,service,service name then start/stop the service. If I have a format of server,script,script_path_name then I am trying to use an invoke-command to run that script. However I need somehow establish a remote session ... Here is the error txt that I get.
[c1399] Connecting to remote server c1399 failed with the following error message : The client cannot connect to the destination specified in the
request. Verify that the service on the destination is running and is accepting requests. Consult the logs and documentation for the WS-Management
service running on the destination, most commonly IIS or WinRM. If the destination is the WinRM service, run the following command on the destination to
analyze and configure the WinRM service: "winrm quickconfig". For more information, see the about_Remote_Troubleshooting Help topic.
+ CategoryInfo : OpenError: (c1399:String) [], PSRemotingTransportException
+ FullyQualifiedErrorId : CannotConnect,PSSessionStateBroken
Here is the current code I am using...
elseif($computer.optype -eq "script")
{
write-host running script $computer.opname on $computer.computername
$Status = Invoke-Command -ComputerName $computer.computername -ScriptBlock { . $computer.opname }
Write-Output "Script execution status for $($computer.name) is $Status" >> C:\Scripts\RMLog.txt
}
Enabled power shell remoting on the server.
To enable PowerShell Remoting, run the following command,
Enable-PSRemoting -Force
Please refer below link for more details
http://www.howtogeek.com/117192/how-to-run-powershell-commands-on-remote-computers/
http://powershelltutorial.net/V2/Powershell-With-TFS
this will solve your issue..
Related
Anchor deploy
Deploying workspace: http://localhost:8899
Upgrade authority: /home/tomcatzy/.config/solana/id.json
Deploying program "basic-1"...
Program path: /home/tomcatzy/projects/anchor/examples/tutorial/basic-1/target/deploy/basic_1.so...
Error: RPC request error: cluster version query failed: error sending request for url (http://localhost:8899/): error trying to connect: tcp connect error: Connection refused (os error 111)
There was a problem deploying: Output { status: ExitStatus(unix_wait_status(256)), stdout: "", stderr: "" }.
solana config set --url http://localhost:8899 (Is this enough to start the localhost ?)
solana-keygen new
solana-test-validator
It seems strange that after a succesful anchor build that i can't do a anchor deploy with the solana command lines ran above.
If by any means 'need' to run a - npm init - then where to do it ?
solana config set --url http://localhost:8899 (Is this enough to start the localhost ?)
solana-keygen new
solana-test-validator
I tried the above and got generated a keypair: keyname_1-keypair.json. The build went succesful but the deploy not !
I'm wondering why not ?
Hopefully some can guide me what to get it succed...
In a separate window / terminal, you need to run solana-test-validator so that the tools can talk to your local network. The error you're seeing on deployment is due to an error on connecting to that network.
By following the Solana docs and doing this
sudo $(command -v solana-sys-tuner) --user $(whoami) > sys-tuner.log 2>&1 &
https://docs.solana.com/running-validator/validator-start#system-tuning
The test-ledger folder is done and a sys-tuner.log file is created but it's 0 bytes...
Then i run the solana-test-validator in a separate terminal and the other solana config commands in another termianl then i get the following results ->
You can deploy on-chain programs with the Solana tools.
To deploy a program, you will need the location of the program's shared object.
It will return when you run anchor build in the command line.
Run solana program deploy <PROGRAM_FILEPATH>.
Successful deployment will return the program id of your program.
I am trying to install sitecore without using SIA due some proxy and firewall security issues.I am following steps mentioned in below URL.
https://naveed-ahmad.com/2019/11/28/install-sitecore-9-3-using-3-simple-commands/
But I kept getting below error even if i have changed my SQL Server name and password for sa user in XP0-SingleDeveloper file.
Don't know why it is still trying to connect to localhost server.
[---------------------------------- XConnectXP0_InstallWDP : WebDeploy -----------------------------------------------]
[WebDeploy]:[Path] C:\Program Files\iis\Microsoft Web Deploy V3\msdeploy.exe
msdeploy.exe : Error Code: ERROR_EXECUTING_METHOD
At C:\Program Files\WindowsPowerShell\Modules\SitecoreInstallFramework\2.3.0\Public\Tasks\Invoke-CommandTask.ps1:31
char:13
& $Path $Arguments | Out-Default
~~~~~~~~~~~~~~~~~~
CategoryInfo : NotSpecified: (Error Code: ERROR_EXECUTING_METHOD:String) [], RemoteException
FullyQualifiedErrorId : NativeCommandError
More Information: Could not deploy package.
Unable to connect to target server 'localhost'. Please verify the connection information such as the server name,
login credentials, and firewall rules for the target server.
Login failed for user 'sa'.
Lear
n more at: http://go.microsoft.com/fwlink/?LinkId=221672#ERROR_EXECUTING_METHOD.
Error: Could not deploy package.
Error: Unable to connect to target server 'localhost'. Please verify the connection information such as the server
name, login credentials, and firewall rules for the target server.
Error: Login failed for user 'sa'.
Error count: 1.
Install-SitecoreConfiguration : Command C:\Program Files\iis\Microsoft Web Deploy V3\msdeploy.exe returned a non-zero
exit code - (-1)
At
1.1.1-r4)\XP0-SingleDeveloper.ps1:77 char:1
Install-SitecoreConfiguration #singleDeveloperParams *>&1 | Tee-Objec ...
+ CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Install-SitecoreConfiguration
[TIME] 00:01:31
Can someone please guide if we need to update any other file for this.
Did you change the $SqlServer variable in the XP0-SingleDeveloper.ps1 ?
It is possible that localhost value comes from the default value which is defined XP0-SingleDeveloper.json parameter file and your custom value is not passed to the install script. You may can try to modify the default in the json file directly too.
"SQLServer": {
"Type": "String",
"DefaultValue": "Localhost",
"Description": "The Sql Server where databases will be installed."
}
Has anyone had success in getting Memurai to run as a service as a Sentinel? Following the instructions from their site,
memurai.exe --service-install --service-name "memurai-sentinel" --sentinel memurai-sentinel.conf
results in
sentinel directive while not in sentinel mode
even with the sentinel flag being present. Cutting out the service flags, it will run as a sentinel without issue.
The Memurai team just released version 2.0.1 which fixes the Memurai Sentinel running as a service issue. Please visit https://www.memurai.com/get-memurai to get the lasted Developer build.
There should be a fix by the Memurai Team in the next release.
Edit: This has been fixed in the Memurai 2.0.1 release.
In the meanwhile, here's a workaround that uses a PowerShell script to add a sentinel service on Windows through other means:
Install Memurai.
Copy sentinel.conf to the desired sentinel working directory. Current values in the files assume C:\sentinelconf\sentinel.conf
Change sentinel.conf with the desired configuration. Current values assume a Redis instance will be running in the same machine in the default port.
Run "Windows PowerShell ISE" as an Administrator:
Open sentinel_script.ps1
Change the variables at the beginning of the file to the desired values.
Run the script (F5)
If it results in a "running scripts is disabled on this system." error:
In the interactive shell run (without the quotes): 'Set-ExecutionPolicy RemoteSigned'
Try running the script again (F5)
In the interactive shell run (without the quotes): 'Set-ExecutionPolicy Restricted'
Connect the sentinel using memurai-cli in the command prompt (without the quotes): 'memurai-cli -p 5000'
Issue command to test the sentinel (without the quotes): 'sentinel master mymaster'
Sample sentinel.conf:
# Copy this file to C:\sentinelconf\sentinel.conf
logfile "C:\sentinelconf\sentinel.log"
port 5000
sentinel monitor mymaster 127.0.0.1 6379 1
sentinel down-after-milliseconds mymaster 60000
sentinel failover-timeout mymaster 180000
sentinel parallel-syncs mymaster 1
The sentinel_script.ps1 file :
# Full path of installed memurai.exe
$MemuraiBinPath="C:\Program Files\Memurai\memurai.exe"
# Full path of sentinel.conf
$SentinelConfPath="C:\sentinelconf\sentinel.conf"
# Full path of sentinel.log
$SentinelLogPath="C:\sentinelconf\sentinel.log"
# Desired name of the service
$SentinelServiceName="Memurai Sentinel"
# Get Network Service credentials
$NetworkServiceCredentials = New-Object -TypeName System.Management.Automation.PSCredential ("NT AUTHORITY\NETWORK SERVICE", (New-Object System.Security.SecureString))
# Create a service to start Memurai in Sentinel mode
New-Service -Name $SentinelServiceName -Credential $NetworkServiceCredentials -BinaryPathName "`"$MemuraiBinPath`" --service-run `"$SentinelConfPath`" --sentinel"
# Create a rule to give the Network Service account access to the paths.
$SentinelAccessRule = New-Object System.Security.AccessControl.FileSystemAccessRule("NT AUTHORITY\NETWORK SERVICE", "FullControl", "ContainerInherit,ObjectInherit", "None", "Allow")
# Get the path where the sentinel.conf file is located and add permissions.
$SentinelConfFolderPath = Split-Path $SentinelConfPath
$ConfPathAccessPermissions = Get-Acl $SentinelConfFolderPath
$ConfPathAccessPermissions.SetAccessRule($SentinelAccessRule)
Set-Acl $SentinelConfFolderPath $ConfPathAccessPermissions
# Get the path where the sentinel.log file is located and add permissions.
$SentinelLogFolderPath = Split-Path $SentinelLogPath
$LogPathAccessPermissions = Get-Acl $SentinelLogFolderPath
$LogPathAccessPermissions.SetAccessRule($SentinelAccessRule)
Set-Acl $SentinelLogFolderPath $LogPathAccessPermissions
# Start the Memurai Sentinel service.
Start-Service $SentinelServiceName
Write-Host "Started the $SentinelServiceName service."
I am trying to connect remote ESX host using PowerCli Version 6.5 release1 to get all VMs from Windows 10 system.
while executing connect-VIServer I am not getting any output or errors. But while execute get-VMHost I get below error message. Vsphere client can connect to the ESX host using the same credentials . Please help fix powercli issue.
PS C:\> Connect-VIServer 10.44.6.45
PS C:\> Get-VMHost
Get-VMHost : 1/25/2019 6:51:43 PM Get-VMHost You are not currently connected to any servers. Please connect first
using a Connect cmdlet.
At line:1 char:1
+ Get-VMHost
+ ~~~~~~~~~~
+ CategoryInfo : ResourceUnavailable: (:) [Get-VMHost], ViServerConnectionException
+ FullyQualifiedErrorId : Core_BaseCmdlet_NotConnectedError,VMware.VimAutomation.ViCore.Cmdlets.Commands.GetVMHost
PS C:\>
Based no your code, I don't believe you're connected to the 10.44.6.45 host. I would expect to see a response with the connected host and the credentials being used to establish that connection whereas your code indicates no response at all.
You may want to attempt the following instead:
$creds = Get-Credential # Note: This will prompt you to enter your credentials
Connect-VIServer -Server 10.44.6.45 -Credential $creds
I'm trying to run a storybook server on AWS Cloud9 but the URL it gives doesn't load anything.
I'm starting the server with
start-storybook -h $HOST -p $PORT --ci
This runs through without error and gives me a "server started" message with a URL. But that URL doesn't connect to anything.
I do notice that the URL isn't secure, and I can imagine AWS having issue with that. There is an --https option on the start-storybook command, but it requires SSL information that I don't know how to source.
Anyone know how this I can get this working?
C9 only opens port 8080, 8081, 8082. So your server should be listening on one of three. Try:
start-storybook -p 8080 s public