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
$cimSessionOption = New-CimSessionOption -Protocol Dcom | |
$cimSession = New-CimSession -ComputerName $env:computername -SessionOption $cimSessionOption | |
Invoke-CimMethod -CimSession $cimSession -ClassName win32_process -methodname Create -Arguments @{ | |
commandline = "powershell.exe -executionpolicy bypass -file \\$env:computername\c`$\ps\test.ps1" | |
} |
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-ADGroupMemberSamAccountName { | |
param( | |
[Parameter(Mandatory,ValueFromPipeline)] | |
[ValidateNotNullOrEmpty()] | |
[string]$GroupName | |
) | |
process { | |
$name = $GroupName | |
$domain = [System.DirectoryServices.ActiveDirectory.Domain]::GetCurrentDomain() | |
$dc = $domain.FindDomainController([System.DirectoryServices.ActiveDirectory.LocatorOptions]::WriteableRequired) |
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
While ( $True ) { $PSise.Options.Zoom = 100 + 10 * [math]::sin( (Get-Date).TimeOfDay.TotalSeconds ); Sleep -Milliseconds 40 } |
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
$definition = @' | |
using System; | |
using System.Runtime.InteropServices; | |
public class W32ShutdownUtil { | |
[DllImport("advapi32.dll", SetLastError = true)] | |
public static extern bool AbortSystemShutdown(String machineName); | |
[DllImport("advapi32.dll", ExactSpelling = true, SetLastError = true)] | |
internal static extern bool AdjustTokenPrivileges(IntPtr htok, bool disall,ref TokPriv1Luid newst, int len, IntPtr prev, IntPtr relen); |
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
# | |
# How to get help right for an array of PSTypeNames | |
# | |
# Awesome function to get some random stuff | |
# The important thing is that we get objects with an added PSTypeName of 'Stuff' | |
Function Get-Stuff { | |
[cmdletbinding()] | |
param( |
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
$tmpFile = New-TemporaryFile | |
@" | |
DisplayName,Phone | |
Johan Akerstrom,0721234567 | |
Test Tester,0711234567 | |
"@ | Set-Content $tmpFile | |
#requires -version 5.1 |
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
# Orginal Cert | |
$base64CertAsGetContentImported = @( | |
'-----BEGIN CERTIFICATE-----' | |
'MIIDPjCCAiagAwIBAgIQQuZ95xvR1p5DHeDuOzxbPzANBgkqhkiG9w0BAQsFADAb' | |
'MRkwFwYDVQQDDBB3d3cuZmFicmlrYW0uY29tMB4XDTIxMDUyNTA3MzAwNFoXDTIy' | |
'MDUyNTA3NTAwNFowGzEZMBcGA1UEAwwQd3d3LmZhYnJpa2FtLmNvbTCCASIwDQYJ' | |
'KoZIhvcNAQEBBQADggEPADCCAQoCggEBANs51YbaCyGdgduRTKAwqd2R9z0BwfH1' | |
'RuBzWP4imFNjvgmJDR4tII3ESng3udp3QqBu8ArdBVAZL0a5w+lJ9uhC8vD+pDGb' | |
'dtEqBi5fSzEMSGahVT+P8VqB2myVah9Ab6kuz5dGjtkIX7aoI3yId3Ji3lU8gtbv' | |
'U8Az5mxqhsDajl9BuUJCtVr02+i4WmbSLI3nzxFDXYJjJIVvrS/yxTzH7nuRud+d' |
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
############################################################### | |
# | |
# A quick look at setting up local PowerShellGet repositories | |
# | |
############################################################### | |
# | |
# Find and install a module from PSGallery |
OlderNewer