Showing posts with label help. Show all posts
Showing posts with label help. Show all posts

Monday, 5 September 2016

How to Login to your Azure from PowerShell

How to Login to your Azure from PowerShell

  • To login to your Azure account, use the Add-AzureRmAccount cmdlet.

Add-AzureRmAccount

  • The cmdlet prompts you for the login credentials for your Azure account. 
  • After logging in, it downloads your account settings so they are available to Azure PowerShell.
  • The account settings expire, so you need to refresh them occasionally. 
  • To refresh the account settings, run Add-AzureRmAccount again.

Saturday, 25 June 2016

PowerShell Basics for Dummies - Get-Service

PowerShell Basics for Dummies - Get-Service


Get-Service:

  • Gets the services running on the specified computers. The default is the local computer.

 Get-Service -ComputerName "Server1"

  • This command gets the services on the "Server1" remote computer.

  • Because the ComputerName parameter of Get-Service does not use Windows PowerShell remoting, you can use this parameter even if the computer is not configured for remoting in Windows PowerShell.


Get-Service "wmi*"

  • This command retrieves services with service names that begin with WMI

Powershell Basics for Dummies - Set-ExecutionPolicy

Powershell Basics for Dummies - Set-ExecutionPolicy

Set-ExecutionPolicy

  • By Default Microsoft has disabled scripting  in an effort to prevent malicious code from executing in a PowerShell environment. 
  • You should use Set-ExecutionPolicy command to control the level of security surrounding PowerShell scripts. 

Four levels of security exist:

  • 1. Restricted — Restricted is the default execution policy and locks PowerShell down, so that commands can be entered only interactively. PowerShell scripts are not allowed to run.
  • 2. All Signed — If the execution policy is set to All Signed then scripts will be allowed to run, but only if they are signed by a trusted publisher like Microsft etc.
  • 3.Remote Signed — If the execution policy is set to Remote Signed, any PowerShell scripts that have been locally created will be allowed to run. Scripts created remotely are allowed to run only if they are signed by a trusted publisher like Microsoft.
  • 4. Unrestricted — Unrestricted removes all restrictions from the execution policy.

You can set an execution policy by entering the Set-ExecutionPolicy command followed by the name of the policy. For example, if you wanted to allow scripts to run in an All Signed manner you could type:

Set-ExecutionPolicy All Signed