Commit 4ce282a5 authored by Dustin L. Howett's avatar Dustin L. Howett

Arg.

parents
Import-VisualStudioVars 140
@{
Name = "Islandwood";
Path = "E:\src\WinObjC";
}
function Get-InstalledSoftware {
<#
.SYNOPSIS
Pull software details from registry on one or more computers
.DESCRIPTION
Pull software details from registry on one or more computers. Details:
-This avoids the performance impact and potential danger of using the WMI Win32_Product class
-The computer name, display name, publisher, version, uninstall string and install date are included in the results
-Remote registry must be enabled on the computer(s) you query
-This command must run with privileges to query the registry of the remote system(s)
-Running this in a 32 bit PowerShell session on a 64 bit computer will limit your results to 32 bit software and result in double entries in the results
.PARAMETER ComputerName
One or more computers to pull software list from.
.PARAMETER DisplayName
If specified, return only software with DisplayNames that match this parameter (uses -match operator)
.PARAMETER Publisher
If specified, return only software with Publishers that match this parameter (uses -match operator)
.EXAMPLE
#Pull all software from c-is-ts-91, c-is-ts-92, format in a table
Get-InstalledSoftware c-is-ts-91, c-is-ts-92 | Format-Table -AutoSize
.EXAMPLE
#pull software with publisher matching microsoft and displayname matching lync from c-is-ts-91
"c-is-ts-91" | Get-InstalledSoftware -DisplayName lync -Publisher microsoft | Format-Table -AutoSize
.LINK
http://gallery.technet.microsoft.com/scriptcenter/Get-InstalledSoftware-Get-5607a465
.FUNCTIONALITY
Computers
#>
param (
[Parameter(
Position = 0,
ValueFromPipeline=$true,
ValueFromPipelineByPropertyName=$true,
ValueFromRemainingArguments=$false
)]
[ValidateNotNullOrEmpty()]
[Alias('CN','__SERVER','Server','Computer')]
[string[]]$ComputerName = $env:computername,
[string]$DisplayName = $null,
[string]$Publisher = $null
)
Begin
{
#define uninstall keys to cover 32 and 64 bit operating systems.
#This will yeild only 32 bit software and double entries on 64 bit systems running 32 bit PowerShell
$UninstallKeys = "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall",
"SOFTWARE\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
}
Process
{
#Loop through each provided computer. Provide a label for error handling to continue with the next computer.
:computerLoop foreach($computer in $computername)
{
Try
{
#Attempt to connect to the localmachine hive of the specified computer
$reg=[microsoft.win32.registrykey]::OpenRemoteBaseKey('LocalMachine',$computer)
}
Catch
{
#Skip to the next computer if we can't talk to this one
Write-Error "Error: Could not open LocalMachine hive on $computer`: $_"
Write-Verbose "Check Connectivity, permissions, and Remote Registry service for '$computer'"
Continue
}
#Loop through the 32 bit and 64 bit registry keys
foreach($uninstallKey in $UninstallKeys)
{
Try
{
#Open the Uninstall key
$regkey = $null
$regkey = $reg.OpenSubKey($UninstallKey)
#If the reg key exists...
if($regkey)
{
#Retrieve an array of strings containing all the subkey names
$subkeys = $regkey.GetSubKeyNames()
#Open each Subkey and use GetValue Method to return the required values for each
foreach($key in $subkeys)
{
#Build the full path to the key for this software
$thisKey = $UninstallKey+"\\"+$key
#Open the subkey for this software
$thisSubKey = $null
$thisSubKey=$reg.OpenSubKey($thisKey)
#If the subkey exists
if($thisSubKey){
try
{
#Get the display name. If this is not empty we know there is information to show
$dispName = $thisSubKey.GetValue("DisplayName")
#Get the publisher name ahead of time to allow filtering using Publisher parameter
$pubName = $thisSubKey.GetValue("Publisher")
#Collect subset of values from the key if there is a displayname
#Filter by displayname and publisher if specified
if( $dispName -and
(-not $DisplayName -or $dispName -match $DisplayName ) -and
(-not $Publisher -or $pubName -match $Publisher )
)
{
#Display the output object, compatible with PowerShell 2
New-Object PSObject -Property @{
ComputerName = $computer
DisplayName = $dispname
Publisher = $pubName
Version = $thisSubKey.GetValue("DisplayVersion")
UninstallString = $thisSubKey.GetValue("UninstallString")
InstallDate = $thisSubKey.GetValue("InstallDate")
} | select ComputerName, DisplayName, Publisher, Version, UninstallString, InstallDate
}
}
Catch
{
#Error with one specific subkey, continue to the next
Write-Error "Unknown error: $_"
Continue
}
}
}
}
}
Catch
{
#Write verbose output if we couldn't open the uninstall key
Write-Verbose "Could not open key '$uninstallkey' on computer '$computer': $_"
#If we see an access denied message, let the user know and provide details, continue to the next computer
if($_ -match "Requested registry access is not allowed"){
Write-Error "Registry access to $computer denied. Check your permissions. Details: $_"
continue computerLoop
}
}
}
}
}
}
\ No newline at end of file
# \\winbuilds\release\RS1_RELEASE\14385.0.160706-1700\amd64fre\media\client_en-us
param (
[String]$Branch = "rs1_release",
[String]$Arch = "amd64fre",
[String]$SKU = "client",
[String]$Language = "en-us",
[Parameter(Mandatory=$true,Position=1)][string]$Build,
[Parameter(Mandatory=$true,Position=2)][string]$DestinationDir
)
$script:outName = "$Branch.$Build.$Arch.$($SKU)_$Language"
robocopy /mir "\\WINBUILDS\Release\$Branch\$Build\$Arch\media\$($SKU)_$Language" $DestinationDir\$script:outName

# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
Name,Color
BackColor,DarkRed
BorderBackColor,DarkRed
BorderColor,Black
BorderTextColor,Yellow
FilterColor,Gray
SelectedBackColor,Yellow
SelectedTextColor,black
TextColor,Green
\ No newline at end of file
#TYPE System.Management.Automation.PSCustomObject
Name,Color
BackColor,White
BorderBackColor,Blue
BorderColor,White
BorderTextColor,Cyan
FilterColor,Cyan
SelectedBackColor,Cyan
SelectedTextColor,Blue
TextColor,Black
Name,Color
BackColor,Gray
BorderBackColor,DarkBlue
BorderColor,Blue
BorderTextColor,Cyan
FilterColor,yellow
SelectedBackColor,Green
SelectedTextColor,Blue
TextColor,Blue
\ No newline at end of file
Name,Color
BackColor,Black
BorderBackColor,Black
BorderColor,Green
BorderTextColor,Green
FilterColor,Gray
SelectedBackColor,Red
SelectedTextColor,Black
TextColor,Green
\ No newline at end of file
Name,Color
BackColor,DarkRed
BorderBackColor,Red
BorderColor,Green
BorderTextColor,Yellow
FilterColor,Gray
SelectedBackColor,DarkGreen
SelectedTextColor,Yellow
TextColor,Green
Name,Color
BackColor,Black
BorderBackColor,DarkGray
BorderColor,Gray
BorderTextColor,Black
FilterColor,Gray
SelectedBackColor,DarkGray
SelectedTextColor,White
TextColor,Gray
Name,Color
BackColor,Black
BorderBackColor,Black
BorderColor,Green
BorderTextColor,Green
FilterColor,Gray
SelectedBackColor,DarkGreen
SelectedTextColor,Green
TextColor,DarkGreen
Name,Color
BackColor,Black
BorderBackColor,Black
BorderColor,Green
BorderTextColor,Green
FilterColor,Gray
SelectedBackColor,DarkGreen
SelectedTextColor,Green
TextColor,DarkGreen
\ No newline at end of file
Name,Color
BackColor,DarkRed
BorderBackColor,Yellow
BorderColor,Red
BorderTextColor,Black
FilterColor,red
SelectedBackColor,yellow
SelectedTextColor,Red
TextColor,Yellow
\ No newline at end of file
Name,Color
BackColor,DarkGray
BorderBackColor,DarkBlue
BorderColor,Blue
BorderTextColor,Yellow
FilterColor,Gray
SelectedBackColor,DarkRed
SelectedTextColor,Red
TextColor,Yellow
#TYPE System.Management.Automation.PSCustomObject
Name,Color
BackColor,Black
BorderBackColor,Black
BorderColor,White
BorderTextColor,White
FilterColor,Gray
SelectedBackColor,Gray
SelectedTextColor,Black
TextColor,White
Name,Color
BackColor,DarkRed
BorderBackColor,DarkBlue
BorderColor,Blue
BorderTextColor,Yellow
FilterColor,DarkGray
SelectedBackColor,DarkRed
SelectedTextColor,Red
TextColor,Yellow
Name,Color
BackColor,white
BorderBackColor,white
BorderColor,Black
BorderTextColor,Black
FilterColor,Gray
SelectedBackColor,Blue
SelectedTextColor,white
TextColor,Black
\ No newline at end of file
This diff is collapsed.
^@ 0 NUL
^A 1 YES
^B 2 YES
^C 3 YES Copy
^D 4 YES
^E 5 YES
^F 6 YES
^G 7 BEL YES Alarm, avoid
^H 8 BS NO
^I 9 TAB NO
^J 10 LF NOT Adds a return without submitting command, but breaks backspacing
^K 11 VT YES
^L 12 FF YES
^M 13 CR NO
^N 14 YES
^O 15 YES
^P 16 YES
^Q 17 YES
^R 18 YES
^S 19 NOT
^T 20 NOT
^U 21 YES
^V 22 YES Paste
^W 23 YES
^X 24 YES Cut
^Y 25 YES
^Z 26 YES Cut word?
^[ 27 ESC YES
^\ 28 FS YES
^] 29 GS YES
^^ 30 RS YES
^_ 31 US YES
\ No newline at end of file
## PSClientManager
$ClientFeatureHandler = {
param($Context, [ref]$TabExpansionHasOutput)
$Argument = $Context.Argument
switch -exact ($Context.Parameter) {
'Name' {
$TabExpansionHasOutput.Value = $true
Get-ClientFeature "$Argument*" | Select-Object -ExpandProperty Name | Sort-Object
}
}
}
$AddClientFeatureHandler = {
param($Context, [ref]$TabExpansionHasOutput)
$Argument = $Context.Argument
switch -exact ($Context.Parameter) {
'Name' {
$TabExpansionHasOutput.Value = $true
Get-ClientFeature "$Argument*" | Where-Object {$_.State -eq "Disabled"} | Select-Object -ExpandProperty Name | Sort-Object
}
}
}
$RemoveClientFeatureHandler = {
param($Context, [ref]$TabExpansionHasOutput)
$Argument = $Context.Argument
switch -exact ($Context.Parameter) {
'Name' {
$TabExpansionHasOutput.Value = $true
Get-ClientFeature "$Argument*" | Where-Object {$_.State -eq "Enabled"} | Select-Object -ExpandProperty Name | Sort-Object
}
}
}
Register-TabExpansion "Add-ClientFeature" $AddClientFeatureHandler -Type "Command"
Register-TabExpansion "Get-ClientFeature" $ClientFeatureHandler -Type "Command"
Register-TabExpansion "Get-ClientFeatureInfo" $ClientFeatureHandler -Type "Command"
Register-TabExpansion "Remove-ClientFeature" $RemoveClientFeatureHandler -Type "Command"
## Robocopy
& {
Register-TabExpansion "robocopy.exe" -Type "Command" {
param($Context, [ref]$TabExpansionHasOutput)
$Argument = $Context.Argument
switch -exact ($Context.Parameter) {
'Options' {
$TabExpansionHasOutput.Value = $true
if ($Argument -notlike "/*") {$Argument = "/$Argument"}
$RoboHelp = robocopy.exe /? | Select-String '::'
$r = [regex]'(.*)::(.*)'
$RoboHelpObject = $RoboHelp | Select-Object `
@{Name='Parameter';Expression={$r.Match($_).Groups[1].Value.Trim()}},
@{Name='Description';Expression={$r.Match($_).Groups[2].Value.Trim()}}
<# ## For now, we don't need category
$RoboHelpObject = $RoboHelpObject | ForEach-Object {$Cat = 'General'} {
if ($_.Parameter -eq '') {
if ($_.Description -ne '') {$cat = $_.Description -replace 'options :',''}
} else {
$_ | Select-Object @{Name='Category';Expression={$cat}},Parameter,Description
}
}
#>
$RoboHelpObject | Where-Object {$_.Parameter -like "$Argument*"} | Select-Object -ExpandProperty Parameter
}
}
}.GetNewClosure()
Function robocopyexeparameters {
param(
[Parameter(Position = 0)]
[String]$Source
,
[Parameter(Position = 1)]
[String]$Destination
,
[Parameter(Position = 2, ValueFromRemainingArguments = $true)]
[String[]]$Options
)
}
$RobocopyCommandInfo = Get-Command "robocopyexeparameters"
Register-TabExpansion "robocopy.exe" -Type "CommandInfo" {
param($Context)
$RobocopyCommandInfo
}.GetNewClosure()
}
## xcopy
& {
Register-TabExpansion "xcopy.exe" -Type "Command" {
param($Context, [ref]$TabExpansionHasOutput)
$Argument = $Context.Argument
switch -exact ($Context.Parameter) {
'Options' {
$TabExpansionHasOutput.Value = $true
if ($Argument -notlike "/*") {$Argument = "/$Argument"}
$r = [regex]'^\s\s(/\S+)*'
xcopy.exe /? | ForEach-Object {$r.Match($_).Groups[1].Value.Trim()} | Where-Object {$_ -like "$Argument*"}
}
}
}.GetNewClosure()
Function xcopyexeparameters {
param(
[Parameter(Position = 0)]
[String]$Source
,
[Parameter(Position = 1)]
[String]$Destination
,
[Parameter(Position = 2, ValueFromRemainingArguments = $true)]
[String[]]$Options
)
}
$xcopyCommandInfo = Get-Command "xcopyexeparameters"
Register-TabExpansion "xcopy.exe" -Type "CommandInfo" {
param($Context)
$xcopyCommandInfo
}.GetNewClosure()
}
## cmdkey
\ No newline at end of file
## netsh
& {
Register-TabExpansion netsh.exe -Type Command {
param($Context, [ref]$TabExpansionHasOutput)
$Argument = $Context.Argument
switch -exact ($Context.Parameter) {
'r' {
$TabExpansionHasOutput.Value = $true
Get-TabExpansion "$Argument*" Computer | New-TabItem -Value {$_.Text} -Text {$_.Text} -Type Computer
}
}
}.GetNewClosure()
Function netshexeparameters {
param(
[String]$a
,
[ValidateSet("advfirewall","branchcache","bridge","dhcpclient","dnsclient","firewall","http","interface","ipsec",
"lan","mbn","namespace","nap","netio","p2p","ras","rpc","trace","wcn","wfp","winhttp","winsock","wlan")]
[String]$c
,
[String]$r
,
[String]$u
,
[String]$p
,
[String]$f
,
[Parameter(Position = 0, ValueFromRemainingArguments = $true)]
[String[]]$Commands
)
}
## TODO: Handle commands and contexts
$netshCommandInfo = Get-Command netshexeparameters
Register-TabExpansion netsh.exe -Type CommandInfo {
param($Context)
$netshCommandInfo
}.GetNewClosure()
Register-TabExpansion netsh.exe -Type ParameterName {
param($Context, $Parameter)
$Parameters = "-a","-c","-r","-u","-p","-f"
$Parameters | Where-Object {$_ -like "$Parameter*"}
}.GetNewClosure()
}
## reg
& {
Register-TabExpansion reg.exe -Type Command {
param($Context, [ref]$TabExpansionHasOutput)
$Argument = $Context.Argument
<#
switch -exact ($Context.Parameter) {
'r' {
$TabExpansionHasOutput.Value = $true
Get-TabExpansion "$Argument*" Computer | New-TabItem {$_.Text} {$_.Text} -Type Computer
}
}
#>
}.GetNewClosure()
Function regexeparameters {
param(
[Parameter(Position = 0)]
[ValidateSet("QUERY","ADD","DELETE","COPY","SAVE","RESTORE","LOAD","UNLOAD","COMPARE","EXPORT","IMPORT","FLAGS")]
[String]$Command
)
}
## TODO: Handle options
$regCommandInfo = Get-Command regexeparameters
Register-TabExpansion reg.exe -Type CommandInfo {
param($Context)
$regCommandInfo
}.GetNewClosure()
}
@{
## Module Info
ModuleVersion = '0.99.6.0'
Description = 'PowerTab Module'
GUID = '64c85865-df87-4bd6-bccd-ea294dc335b3'
## Module Components
ScriptsToProcess = @()
ModuleToProcess = @("PowerTab.psm1")
TypesToProcess = @()
FormatsToProcess = @()
ModuleList = @("PowerTab.psm1")
FileList = @()
## Public Interface
CmdletsToExport = ''
FunctionsToExport = @('*-*')
VariablesToExport = @('PowerTabConfig','PowerTabError')
AliasesToExport = '*'
## Requirements
PowerShellVersion = '2.0'
PowerShellHostName = ''
PowerShellHostVersion = ''
RequiredModules = @()
RequiredAssemblies = @()
ProcessorArchitecture = 'None'
DotNetFrameworkVersion = '2.0'
CLRVersion = '2.0'
## Author
Author = 'Marc "/\/\o\/\/" van Orsouw, Jason Archer'
CompanyName = ''
Copyright = ''
## Private Data
PrivateData = ''