27 Dec

Listing windows services statuses with Powershell

03 Aug

Listing IIS Application Pool Memory usage in PowerShell

Open Powershell as an Administrator on the web server, then run:

You should see something like:

If you get Get-WmiObject : Could not get objects from namespace root/WebAdministration. Invalid namespace then you need to enable the IIS Management Scripts and Tools feature using:

13 Jul

CredSSP authentication problem in Powershell Remote Queries

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”

credssp

 

for more info: https://technet.microsoft.com/en-us/library/hh849872.aspx

07 Jan

How to troubleshoot memory issues when executing remote Powershell queries

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:

 

And here is the command for change the value:

or

winrm set winrm/config/winrs @{MaxMemoryPerShellMB=”512″}

 

powershellmemory

 

In some cases, you need to restart the WinRM service on target system:

28 Apr

How to connect Oracle DB with PowerShell

connect to Oracle

Create a datareader for a SQL statement

Write out the results