Skip to content

Instantly share code, notes, and snippets.

[CmdletBinding()]
PARAM(
[Parameter(Mandatory=$false)][String] $UserCredentialPath = "C:\PS\Cred_User.xml",
[Parameter(Mandatory=$false)][String] $ComputerCredentialPath = "C:\PS\Cred_Comp.xml"
)
function Invoke-LocalAccount
{
[CmdletBinding()]
PARAM(
pragma solidity ^0.5.0;
contract IERC20 {
function totalSupply() public view returns (uint256);
function balanceOf(address _account) public view returns (uint256);
function transfer(address _to, uint256 _tokens) public returns (bool);
function approve(address _spender, uint256 _tokens) public returns (bool);
function transferFrom(address _from, address _to, uint256 _tokens) public returns (bool);
function allowance(address _account, address _spender) public view returns (uint256);
pragma solidity ^0.5.0;
contract Mul
{
function Mul_v1(uint[50] calldata array, uint i, uint j) external pure returns(uint c) { return array[i] * array[j]; }
function Mul_v2(uint[50] memory array, uint i, uint j) public pure returns(uint c) { return array[i] * array[j]; }
function Mul_v3(uint[50] memory array, uint i, uint j) internal pure returns(uint c) { return array[i] * array[j]; }
}
pragma solidity ^0.5.15;
contract IERC20 {
function totalSupply() external view returns (uint256);
function balanceOf(address _account) external view returns (uint256);
function transfer(address _to, uint256 _tokens) external returns (bool);
function approve(address _spender, uint256 _tokens) external returns (bool);
function transferFrom(address _from, address _to, uint256 _tokens) external returns (bool);
function allowance(address _account, address _spender) external view returns (uint256);
pragma solidity ^0.5.15;
interface IERC20_v2 {
function totalSupply() external view returns (uint256);
function balanceOf(address _account) external view returns (uint256);
function transfer(address _to, uint256 _tokens) external returns (bool);
function approve(address _spender, uint256 _tokens) external returns (bool);
function transferFrom(address _from, address _to, uint256 _tokens) external returns (bool);
function allowance(address _account, address _spender) external view returns (uint256);
pragma solidity ^0.5.15;
contract IERC20_v1 {
function totalSupply() public view returns (uint256);
function balanceOf(address _account) public view returns (uint256);
function transfer(address _to, uint256 _tokens) public returns (bool);
function approve(address _spender, uint256 _tokens) public returns (bool);
function transferFrom(address _from, address _to, uint256 _tokens) public returns (bool);
function allowance(address _account, address _spender) public view returns (uint256);
$Servers = Import-Csv -Path 'D:\Data\ListOfServers.csv'
$Output = @('Source','Destination','IPAddress','PingStatus','Date','Time','ErrorMessage')
$Servers = $Servers | Select-Object -Property @{Name='HostName';Expression={$_.ComputerName}},@{Name='Data';Expression={ [String]::Empty | Select-Object -Property $Output}}
$Servers | fl *
$Servers | ForEach-Object -Parallel {
$_.Data.Date = (Get-Date -Format 'dd-MMM-yyyy')
$_.Data.Time = (Get-Date -Format 'HH:mm:ss')
$_.Data.Source = $env:COMPUTERNAME
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)][String] $ComputerName = $env:COMPUTERNAME,
[Parameter(Mandatory=$false)][ValidateSet('Start','Stop','Enable','Delete','Create')][String] $Action
)
try
{
$TaskName = 'Maintenace'
$TaskPath = '\'
$Inf = @"
[NewRequest]
Subject="CN=adfs.infra.private,O=Local,OU=IT,C=US"
KeySpec = 1
KeyLength = 2048
HashAlgorithm = SHA256
Exportable = TRUE
MachineKeySet = TRUE
SMIME = False
PrivateKeyArchive = FALSE
$TrustName = "ClaimsXray"
$AuthZRules = "=>issue(Type = `"http://schemas.microsoft.com/authorization/claims/permit`", Value = `"true`"); "
$IssuanceRules = "@RuleName = `"Issue all claims`"`nx:[]=>issue(claim = x); "
$RedirectUrl = "https://adfshelp.microsoft.com/ClaimsXray/TokenResponse"
$SamlEndpoint = New-AdfsSamlEndpoint -Binding 'POST' -Protocol 'SAMLAssertionConsumer' -Uri $RedirectUrl
Add-ADFSRelyingPartyTrust `
-Name $TrustName `
-Identifier "urn:microsoft:adfs:claimsxray" `
-IssuanceAuthorizationRules $AuthzRules `
-IssuanceTransformRules $IssuanceRules `