Monthly Archives: May 2016

In May 2014, I published a PowerShell Module in the TechNet Gallery. It has a five star rating after all based on four votes, LOL. Anyways, I revised that module in order to support pipeline processing and whatif. Furthermore, I decided to publish the Subversion module in the PowerShell Gallery

The Subversion Powershell Module provides a bunch of functions and aliases to work with Subversion/SVN working copies. It requires the Subversion command-line binary svn.exe.

Update-SvnWorkingCopy brings the latest changes (HEAD revision) from the repository into an existing working copy.

Publish-SvnWorkingCopy sends the changes from your working copy to the repository.

Import-SvnUnversionedFilePath commits an unversioned file or directory tree into the repository.

New-SvnWorkingCopy checks out a working copy from a repository (HEAD revision).

Get-SvnWorkingCopy returns the status of working copy files and directories.

Add-SvnWorkingCopyItem puts files and directories under version control, that is scheduling them for addition to repository in next commit.

Remove-SvnWorkingCopyItem removes files and directories from version control, that is scheduling them for deletion upon the next commit. (Items that have not been committed are immediately removed from the working copy.)

Repair-SvnWorkingCopy fixes a working copy that has been modified by non-svn commands in terms of file addition and removal. The function identifies items that are not under version control and items that are missing. It puts non-versioned items under version control, and it removes missing items from version control (i.e. schedule for deletion upon next commit).

Switch-SvnWorkingCopy updates the working copy to a different URL within the same repository.

The functions provide only basic functionality and work fine with the subversion command line client from http://www.collab.net/downloads/subversion

The PowerShell cmdlet below, Get-AzureRmVMStatus, helps to you get a list of Azure VMs and their status (PowerState) within a given resource group. You can supply a VM name filter if you want to enclose only specific VMs in the result.

PowerShell

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

<#

.SYNOPSIS

Get a list of Azure VMs and their Status within a given resource group.

.DESCRIPTION

The Get-AzureRmVMStatus helps to you get a list of Azure VMs and their

status (PowerState) within a given resource group. You can supply a

VM name filter if you want to enclose only specific VMs in the result.

.EXAMPLE

Get-AzureRmVMStatus -ResourceGroupName 'myrg01'

.EXAMPLE

Get-AzureRmVMStatus -ResourceGroupName 'myrg01' -Name '*desktop*'

.NOTES

Author : Frank Peter Schultze

Date : 2016-05-19

#>

functionGet-AzureRmVMStatus{

[CmdletBinding()]

param(

#The name of a resouce group in your subscription

[Parameter(Mandatory=$true)]

[string]

$ResourceGroupName

,

#VM name filter

[Parameter()]

[string]

$Name='*'

)

Get-AzureRmVM-ResourceGroupName$ResourceGroupName|

Get-AzureRmVM-Status|

Select-Object-PropertyName,Statuses|

Where-Object{$_.Name-like$Name}|

ForEach-Object{

$VMName=$_.Name

$_.Statuses|

Where-Object{$_.Code-like'PowerState/*'}|

ForEach-Object{

New-Object-TypeNamepsobject-Property@{

Name=$VMName

Status=$_.DisplayStatus

}

}

}

}

The usage of this function is as simple as…

PowerShell

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

PSC:\>Get-AzureRmVMStatus-ResourceGroupName'myrg01'

Name Status

----------

mylabaddsdc01 VM deallocated

mylabdesktop01 VM deallocated

PSC:\>Get-AzureRmVMStatus-ResourceGroupName'myrg01'-Name'*desktop*'

Name Status

----------

mylabdesktop01 VM deallocated

PSC:\>

Of couse, you need to log on to you Azure subscription before. (Login-AzureRmAccount)