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
#requires -version 4.0 | |
Function Convert-CSVtoXLS { | |
<# | |
.SYNOPSIS | |
This function converts a CSV file to an Excel workbook. | |
.DESCRIPTION | |
Convert-CSVtoXLS converts a csv file to a Excel workbook. | |
The first line of the CSV file is turned into a filtering header. | |
Excel must be installed on the computer. |
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 Start-ManagementConsole { | |
Param( [string]$ComputerName = '.' ) | |
Start-Process -FilePath "${env:windir}\System32\mmc.exe" ` | |
-ArgumentList "compmgmt.msc /computer:\\${ComputerName}" | |
} | |
New-Alias -Name manage -Value "Start-ManagementConsole" -Scope Global |
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 { | |
'' | |
} | |
} |
OlderNewer