This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Gets a computer to boot on PXE at next boot, clears the flag, | |
or retrieve the information. | |
Works for Dell systems with the Sysman WMI layer installed. | |
LAST UPDATED: 18/02/2015 | |
AUTHOR : Xavier Plantefève | |
#> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.SYNOPSIS | |
Converts objects into a series of comma-separated value (CSV) variable-length strings. | |
.DESCRIPTION | |
The ConvertTo-CSV cmdlet returns a series of comma-separated (CSV) strings that represents the objects that you submit. You can then use the ConvertFrom-CSV cmdlet to re-create | |
objects from the CSV strings. The resulting objects are CSV versions of the original objects that consist of string representations of the property values and no methods. | |
You can also use the T:Microsoft.PowerShell.Commands.Export-Csv and T:Microsoft.PowerShell.Commands.Import-Csv cmdlets to convert objects to CSV strings (and back). Export-CSV is the | |
same as ConvertTo-CSV, except that it saves the CSV strings in a file. | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function ConvertFrom-Csave { | |
[CmdletBinding(DefaultParameterSetName='UseDelimiter')] | |
Param ( | |
[Parameter(Position=2,ParameterSetName='UseDelimiter')] | |
[char]$Delimiter = ',', | |
# FIXME | |
[string[]] $Header, | |
[Parameter(Mandatory=$True,Position=1,ValueFromPipeline=$True,ValueFromPipelineByPropertyName=$true)] | |
[PSObject] $InputObject, | |
[Parameter(Mandatory=$True,Position=2,ParameterSetName='UseCulture')] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.LINK | |
https://social.technet.microsoft.com/Forums/scriptcenter/en-US/bfe66e89-e6ea-48e8-bcab-6f260493944e/powershell-listing-of-all-files-and-owner-to-csv | |
#> | |
# version 1. Note that "-Attributes" was not available in 2010 (PoSh2) | |
Get-ChildItem -Recurse -Attributes !Directory | | |
ForEach-Object { Add-Member -InputObject $_ -NotePropertyName Acl -NotePropertyValue (Get-Acl $_.FullName) -PassThru } | | |
Select-Object DirectoryName,Name,length,@{Name='Owner';Expression={$_.acl.Owner}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Convert-Currency ($transaction) | |
{ | |
If ($transaction.Exb -eq '1') { | |
return [math]::Round([decimal]$transaction.Am / | |
[decimal]$transaction.Exr,2) + $transaction.exf | |
} else { | |
return [math]::Round([decimal]$transaction.Am * | |
[decimal]$transaction.Exr,2) + $transaction.exf | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$test=@( | |
'LastName1, FirstName1', | |
'ShortName1', | |
'LastName2, FirstName2', | |
'ShortName2', | |
'LastName3, FirstName3', | |
'ShortName3' | |
) | |
$odd = $true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function New-Dog { | |
param( | |
[Parameter(Mandatory=$true)] | |
[string]$Name, | |
[Parameter(Mandatory=$false)] | |
[ValidateSet('small', 'medium','large', $null)] | |
[string]$size, | |
[Parameter(Mandatory=$false)] | |
[string]$color | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Get-ADReferent ($user) | |
{ | |
$user = $user -replace '^adm-','' | |
Try { | |
$test = Get-ADUser $user | |
$test.SamAccountName | |
} Catch { | |
'' | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.Synopsis | |
Gets computer information from Surveyor | |
.DESCRIPTION | |
Returns computers from the Surveyor database. Can return information for | |
specific computers or a filtered subset of the DB table. | |
.EXAMPLE | |
Get-SurveyorComputer -Name MyComputerName | |
Returns information for the computer named MyComputerName. | |
.EXAMPLE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
.Synopsis | |
Opens a connection to a SQL server. | |
.DESCRIPTION | |
Opens a connection to a SQL server and provides a sqlConnection object. | |
the connection object has to be closed at the end of the processing. | |
.EXAMPLE | |
$con = Open-SQLServer -Server SQLSVR -Database MyDataBase | |
Opens a connection to the MyDataBase DB on SQLSVR. | |
.LINK |
OlderNewer