If you receive the following error while running remote .exe files from in powershell.
UNKNOWN: WEB SERVICE STATUS [vmserver01] Connecting to remote server failed with the following error message : The WinRM client cannot process the request. CredSSP authentication is currently disabled in the client configuration. Change the client configuration and try the request again. CredSSP authentication must also be enabled in the server configuration. Also, Group Policy must be edited to allow credential delegation to the target computer. Use gpedit.msc and look at the following policy: Computer Configuration -> Administrative Templates -> System -> Credentials Delegation -> Allow Delegating Fresh Credentials. Verify that it is enabled and configured with an SPN appropriate for the target computer. For example, for a target computer name “myserver.domain.com”, the SPN can be one of the following: WSMAN/myserver.domain.com or WSMAN/*.domain.com For more information, see the about_Remote_Troubleshooting Help topic.
Resolution:
Use below cmdlet enable CredSSP on the server by specifying Server in Role
Enable-WSManCredSSP -Role “Server”
for more info: https://technet.microsoft.com/en-us/library/hh849872.aspx
If you are receiving “Processing data for a remote command failed with the following error message: The WSMan provider” message from the PS Queries (e.g. on the Nagios)
All you have to do is log on the target computer, and run powershell with Administrator Rights. Then you can increase Powershell memory with below commands
You can get current memory size with get-item:
Get-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB
And here is the command for change the value:
Set-Item WSMan:\localhost\Shell\MaxMemoryPerShellMB 250 -Force
or
winrm set winrm/config/winrs @{MaxMemoryPerShellMB=”512″}
In some cases, you need to restart the WinRM service on target system:
Restart-Service winrm
I was looking for a good (and free) GoLang IDE. Then I found fully opensource LITEIDE. It supports code completion and syntax highlighting. Also has a debugger which running in background.
You can download it from below link:
http://code.google.com/p/golangide/
Catch [System.OutOfMemoryException]{ bla bla bla... }
I was installed Fedora VM in to 8 GB Virtual Disk (vdi) but now I need to resize disk to 16 GB
VBoxManage modifyhd “D:\VirtualBox VMs\Fedora\Fedora.vdi” –resize 16384
Now the linux part.
You’d have to unmount it to shrink it (which requires a LiveCD / Rescue Mode.)
pvresize /dev/sda2
(assuming your LVM partition is sda2
. Replace as required.)lvextend /dev/mapper/root -l+100%FREE
(or, whatever your root logical volume is called.)resize2fs /dev/mapper/root
(assuming ext2/3/4)Using PowerShell
Import-Module ServerManager Add-WindowsFeature PowerShell-ISE
Tags: powershell
Raspberry Pi Zero has released out this week. It’s not powerful as Raspberry Pi 2. However specs is so good for 5$ computer.
Comparison with a playing card
For more information : https://www.raspberrypi.org/blog/raspberry-pi-zero/
grep -rl 'old-string' ./ | xargs sed -i 's/old-string/new-string/g'
This will search for the string ‘old-string’ in all files relative to the current directory and replace ‘old-string’ with ‘new-string’ for each occurrence of the string in each file.
# Load the ODP assembly [Reflection.Assembly]::LoadFile("C:\oracle\11.2.0\client_2\odp.net\bin\4\Oracle.DataAccess.dll")|Out-Null
# #vars&cons $stations =@{ "424"="Istanbul"; "421"="İzmir" } $dbuser="user" $dbpasswd="password"
connect to Oracle
$constr = " User Id=$dbuser; Password=$dbpasswd; Data Source=CITIES " $conn= New-Object Oracle.DataAccess.Client.OracleConnection($constr) $conn.Open()
Create a datareader for a SQL statement
$sql="select stationid from CITIES.SWITCHPARAMETER where switchid = '2' " $command = New-Object Oracle.DataAccess.Client.OracleCommand( $sql,$conn) $reader=$command.ExecuteReader()
Write out the results
# while ($reader.read()) { $stationID=$reader.GetString(0) $stationname=$stations.Get_Item($stationID) Write-Host " Station ID: $stationID ($stationname)" }
Tags: oracle, powershell
to find last edited file in a folder on unix CLI:
`ls -1t | head -1`
to edit the file:
more `ls -1t | head -1`