Saturday, October 13, 2018

WINDOWS POWERSHELL COMMANDS

WINDOWS POWERSHELL COMMANDS

Open your power shell from command prompt as a administrator.

Point to remember : Declare any variable with $y in PowerShell


C:\WINDOWS\system32>$array ="India","Japan","Aus","US","UK"

C:\WINDOWS\system32> $array

It will list an array


PS C:\WINDOWS\system32> $array[2]

It gives value on index 2 , which is AUS in our case.


image

$array=("India","Asia"),("Japan","Asia"),("AUstralia","Australia"),("UK","EUROPE"),("US","North America”)

PS C:\WINDOWS\system32> $array

PS C:\WINDOWS\system32> $array[0][1]
Asia
PS C:\WINDOWS\system32> $array[1][1]
Asia
PS C:\WINDOWS\system32> $array[1][0]


======================================

Some mathematical commands show below:

PS C:\WINDOWS\system32> $y=get-service
PS C:\WINDOWS\system32> $y.count
292
PS C:\WINDOWS\system32> [math]::sqrt("9")
3
PS C:\WINDOWS\system32> $x="192.78788"
PS C:\WINDOWS\system32> [math]::round($x,2)
192.79








4. To update the value of an index in array as shown below:

PS C:\WINDOWS\system32> $array[1][0]="Singapore"
PS C:\WINDOWS\system32> $array[1][0]



5. To change the variable case in upper and lower use the following command


PS C:\WINDOWS\system32> $x="The quick brown fox jumps right over the lazy little dogs"
PS C:\WINDOWS\system32> $x.ToUpper()
THE QUICK BROWN FOX JUMPS RIGHT OVER THE LAZY LITTLE DOGS
PS C:\WINDOWS\system32> $x.TOLOWER()

Output
the quick brown fox jumps right over the lazy little dogs


6. To replace any word


PS C:\WINDOWS\system32> $x.replace("The","That")
That quick brown fox jumps right over the lazy little dogs



7. To Get complete service object in a variable

Declare any variable with $y in PowerShell

PS C:\WINDOWS\system32> $y=get-service
PS C:\WINDOWS\system32> $y.count
Output : 292

Wednesday, October 10, 2018

Azure Session in Noida,India

Conducted and Executed Azure session in Noida today Some Glimpse Conversation following topics

Image result for azure images

  • Azure
    ARM Portal (Azure Resource Manager)
    Azure Service Model
    ARM Portal Deep Dive
    Platform As A Service(PaaS)
    Hosting .Net WEBAPI Application
    Application Insights
    Application Insights Telemetry
    Live Streaming of execution
    Logic Apps as WebHook
    Logic apps integration with Skype/Slack for notification
    Create Logic apps for Twitter Integration with Slack(AI Usage)
    Stay in Cloud





10 OCT 2018


@Azure @ARM @LogicApps

Sunday, October 7, 2018

POWER SHELL COMMANDS

POwer SHELL COMMANDS


get-help workerrole
get-help webrole
get-help *content*
get-help storage
get-command *event

get-eventlog system

get-eventlog system -newest 10 // to get latest 10 log
 
get-eventlog system -newest 10 | where {$_.instanceid -eq 129} // To get the specific event
 
get-eventlog system -newest 10 | where {$_.instanceid -lt 1219} // to get all events less than event id 129
  
get-service | export-csv -path E:\Service.csv -- to export all services to E drive through command 

import-csv E:\Service.csv


TO Export all process in xml format :


get-process | export-clixml -path  e:\training.xml

TO Export all process in txt format :

get-process | out-file -filepath  e:\training.txt

To open in notepad :

invoke-item  e:\training.txt


To get all service in html format:


get-service | convertto-html


get-service | convertto-html | set-content E:\xyz.xml


To retrieve only two columns from Services:


get-service | convertto-html -property name,status



List of service starts with character “S”


get-service s*


To get process which has id less than 100

get-process | where id -lt 100


To Get service which are running using where clause in powershell:


get-service | where {$_.status -eq "running"}

get-service | where {$_.status -eq "stopped"}