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 3 | |
function Remove-Profile { | |
param( | |
[string[]]$ComputerName = $env:ComputerName, | |
[pscredential]$Credential = $null, | |
[string[]]$Name, | |
[ValidateRange(0,365)][int]$DaysOld = 0, | |
[string[]]$Exclude, | |
[switch]$IgnoreLastUseTime, | |
[switch]$Remove |
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
@ECHO off | |
@setlocal EnableDelayedExpansion | |
@goto label1 | |
@echo this lines should not be printed | |
@echo and this whole block (lines 4-8) can actually be removed | |
@echo I added these just for Charlie22911 | |
@:label1 | |
@set LF=^ |
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-CertificateFromCredential { | |
param([PSCredential]$Credential) | |
Add-Type -TypeDefinition @' | |
using System; | |
using System.Runtime.InteropServices; | |
public static class NativeMethods { |
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
#region ### BUILD THE CONFIGURATION ### | |
# Declare the configuration: | |
Configuration TestDscWithoutWinRm { | |
Import-DscResource –ModuleName PSDesiredStateConfiguration | |
node localhost { | |
File akada { | |
Ensure = 'Present' | |
Type = 'File' | |
Contents = 'Martin was here!' |
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
# The identity to add permissions for | |
$Identity = "myDomain\nonAdmins" | |
# The configuration name to change permissions to (default is 'microsoft.powershell') | |
$sessionConfigurationName = 'microsoft.powershell' | |
# Get the current permissions on the default endpoint | |
$sddl = (Get-PSSessionConfiguration -Name $sessionConfigurationName).SecurityDescriptorSddl |
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-LogonReport { | |
param($ComputerName = $Env:COMPUTERNAME) | |
$filterXml = '<QueryList><Query Id="0" Path="Security"><Select Path="Security">*[System[(EventID=4624)]]</Select></Query></QueryList>' | |
$logonTypes = @{ | |
2 = 'Interactive' | |
3 = 'Network' | |
4 = 'Batch' | |
5 = 'Service' | |
6 = 'Proxy' |
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
#region Helper functions | |
function Set-Ownership { | |
[CmdletBinding(SupportsShouldProcess = $false)] | |
param( | |
[Parameter(Mandatory = $true)] | |
[ValidateNotNullOrEmpty()] | |
[string]$Path, | |
[Parameter(Mandatory = $true)] | |
[ValidateNotNullOrEmpty()] [ValidatePattern('(\w+)\\(\w+)')] |
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-MsiProductInformation { | |
param($Path) | |
$msis = Get-ChildItem -File -Path $Path -Filter '*.msi' | |
foreach($msi in $msis) { | |
$WI = New-Object -ComObject WindowsInstaller.Installer | |
$DB = $WI.GetType().InvokeMember("OpenDatabase","InvokeMethod", $Null, $WI, @($msi.FullName, 0)) | |
$query = 'SELECT * FROM Property' | |
$View = $DB.GetType().InvokeMember("OpenView","InvokeMethod",$Null,$DB,($query)) | |
$View.GetType().InvokeMember("Execute", "InvokeMethod", $Null, $View, $Null) |
OlderNewer