Skip to content

Instantly share code, notes, and snippets.

Tore Groneng torgro

View GitHub Profile
View Get-XMLdocument.ps1
Function Get-XMLdocument
{
[CmdletBinding()]
Param()
$f = $MyInvocation.InvocationName
Write-Verbose -Message "$f - START"
$data = @"
<xml version="1.0" encoding="UTF-8">
<SillySystem>
View Export-Object.ps1
function Export-Object
{
[cmdletbinding()]
Param(
[Parameter(Mandatory)]
[string]$xPath
,
[pscredential]$Credential
,
[string]$Uri
View Import-Object.ps1
function Import-Object
{
[cmdletbinding()]
Param(
[Parameter(Mandatory)]
[Hashtable]$KeyValue
,
[pscredential]$Credential
,
[string]$Uri
View config.ps1
configuration Telnet
{
Param(
[String[]]$Computername
)
Foreach ($computer in $computername)
{
Node "$computer"
{
WindowsFeature TelnetClient
View powershellprocess.ps1
function Get-PowershellProcess
{
[cmdletbinding()]
Param(
$ProcessName = "Powershell"
)
Write-Information -MessageData "this is info data" -Tags GetPowershellprocess
Get-Process -Name $ProcessName
}
View powershellprocesswithwritehost.ps1
function Get-PowershellProcess
{
[cmdletbinding()]
Param(
$ProcessName = "Powershell"
)
Write-Host -Object "I do not care about the puppies"
Write-Information -MessageData "this is info data" -Tags GetPowershellprocess
Get-Process -Name $ProcessName
View powershellprocess.ps1
function Get-PowershellProcess
{
[cmdletbinding()]
Param(
$ProcessName = "Powershell"
)
Write-Information -MessageData "this is info data" -Tags GetPowershellprocess
Get-Process -Name $ProcessName
View Alphabet.ps1
([System.Linq.Enumerable]::Range([char]"a",26) |
foreach {
[System.Convert]::ToString([char][int]$_)
}) -join ""
View nugetPacketInstall.ps1
$nugetConfig = @'
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="WindowsAzure.ServiceBus" version="2.6.7" targetFramework="net45" />
</packages>
'@
Set-Content -Path .\packages.config -Value $nugetConfig
$nuget = Get-PackageProvider -Name Nuget -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
View Test-Logging.ps1
function Test-Logging
{
[cmdletbinding()]
Param(
[string]$Name
)
$f = $MyInvocation.InvocationName
Write-Verbose -Message "$f - START"
You can’t perform that action at this time.