Article archive
Create TFS Tasks from XML with validation
15/10/2012 17:33
#we have two files, one for TFS Tasks creation and one with XSD validation.
#Then your xml file and xsd file are needed.
#TFS Task creation file
#input...
Get the name or location of current script and parent path
15/10/2012 15:49
#full name
$Myinvocation.invocationname
#path
$myinvocation.InvocationName | split-path -parent
#filename
$myinvocation.mycommand.Name
#MyInvocation.InvocationName doesn't work for PowerGUI, use this instead to get path of current running script
Split-Path...
Get file path and file name from full file name
15/10/2012 15:32
$path = "c:\temp\filename.txt"
split-path $path
returns "c:\temp"
split-path $path -leaf
returns filename.txt
Get-Item $path | select BaseName, Extension
BaseName Extension
-------- ---------...
XML validation against XSD
15/10/2012 12:55
Function Validate-Xml{
param(
[Parameter(
Mandatory = $true,
Position = 0,
...
Inline XML validation against XSD
15/10/2012 11:48
#there must be reference to xsd file in xml file
<?xml version="1.0" encoding="utf-8"?>
<Tasks xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="c:\temp\TFSdefaultTasksXML.xsd">
<Task>
...
Upload files with metadata
14/10/2012 22:25
#Upload pictures with informations
#input parameters
$srcPath="C:\cham.Install\NewsPages" #source folder for Pages on file system
$siteUrl="https://localhost/sites/news" #$SiteUrl #got from Run.ps1
$libraryUrl=$siteUrl+"/Pages"
#metadata (NewsTitle, PageContent, Highlighted)...
Delete list items
14/10/2012 22:17
$serverUrl="https://localhost/sites/sectionedlinks"
$listName="Sectioned Links Sections"
function DeleteListItems([string] $siteUrl, [string] $listName)
{
...
Skip foreach item and suppress output
13/10/2012 21:20
$a=(1, 2, 5, 6, 4, 1, 5)
foreach($item in $a)
{
if($item -ge 5)
{
#this causes moving to next item in foreach loop: |out-null supresses 'true' or 'false' message
...
Create menu item in Powershell ISE
13/10/2012 05:28
#IItem is added to 'Add-ons' menu in Powershell ISE
#it is there only until you close an instance of powershell
function AddPSSnapin
{
# check to ensure Microsoft.SharePoint.PowerShell is loaded
$snapin=Get-PSSnapin | Where-Object {
...
Create TFS work items from XML file
13/10/2012 02:38
#input parameters
$sourceFilePath="c:\temp\TFSdefaultTasksXMLshort2.xml"
#input parameters
$parentId=391
$areaPath=“ComponentFactory\12. External Video"
$iterationPath=“ComponentFactory\Release 1\Sprint 12"
$defaultPriority=1000
#takes component name from areaPath (e. g. External...
Items: 281 - 290 of 384