Skip to content

Instantly share code, notes, and snippets.

View rysstad's full-sized avatar

Tor Arne Rysstad rysstad

View GitHub Profile
@rysstad
rysstad / settings.json
Last active June 24, 2019 18:06
Visual Studio Code settings,json
{
"breadcrumbs.enabled": true,
"editor.accessibilitySupport": "off",
"editor.fontFamily": "'Fira Code', Consolas, 'Courier New', monospace",
"editor.fontLigatures": true,
"editor.fontSize": 12,
"editor.minimap.enabled": false,
"editor.tabSize": 2,
"editor.lineNumbers": "on",
"files.insertFinalNewline": true,
@rysstad
rysstad / extApps.xml
Last active September 27, 2023 11:24
mRemoteNG - external tools
<?xml version="1.0" encoding="utf-8"?>
<Apps>
<App DisplayName="Computer Manager" FileName="%WINDIR%\system32\compmgmt.msc" Arguments="/Computer=%HostName%" WorkingDir="" WaitForExit="False" TryToIntegrate="False" RunElevated="False" ShowOnToolbar="True" />
<App DisplayName="Explorer - C: " FileName="%WINDIR%\explorer.exe" Arguments="\\%HostName%\c$" WorkingDir="" WaitForExit="False" TryToIntegrate="False" RunElevated="False" ShowOnToolbar="True" />
<App DisplayName="Explorer - E:" FileName="%WINDIR%\explorer.exe" Arguments="\\%HostName%\e$" WorkingDir="" WaitForExit="False" TryToIntegrate="False" RunElevated="False" ShowOnToolbar="True" />
<App DisplayName="Powershell - CredSSP" FileName="%WINDIR%\system32\WindowsPowerShell\v1.0\PowerShell.exe" Arguments="-NoProfile -NoExit -Command &quot;&amp;{ Set-Location -Path C:\Temp\ ; $host.ui.RawUI.WindowTitle= '%Hostname%' ; Enter-PSSession -Authentication CredSSP -ComputerName %Hostname% -EnableNetworkAccess -Credential $(Get-Credential -Message 'Lo
@rysstad
rysstad / Get-PrivilegeLevel.ps1
Created October 4, 2015 18:34
Check whether or not Powershell is running as admin (elevated) or not
If ( ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Output "Powershell running with elevated privileges"
} else {
Write-Output "Powershell running as user, without admin privileges"
}
@rysstad
rysstad / Sharepointactivityperminuteyesterday.sql
Created June 17, 2015 12:22
Sharepoint activity per minute yesterday
-- Sharepoint activity per minute yesterday
SELECT Min(logtime) AS 'Between',
-- Max(logtime) AS 'Until',
-- CONVERT(VARCHAR(23), Min(logtime), 126) AS 'ISO8601Time',
-- Datepart(hour, logtime) AS 'Hour',
Count(logtime) AS 'TotalPageViews',
Count(DISTINCT userlogin) AS 'UniqueUsers'
FROM [WSS_UsageApplication].[dbo].[requestusage]
WHERE ( logtime < Dateadd(d, -0, Datediff(d, 0, Getdate())) )
AND ( logtime > Dateadd(d, -1, Datediff(d, 0, Getdate())) )
@rysstad
rysstad / compare-ADUsers.ps1
Created June 2, 2015 13:35
Compare two AD user account, show difference in group memberships
If ( ! (Get-module ActiveDirectory )) {
Import-Module ActiveDirectory
}
# accunts to compare
$UserName1 = "Username1"
$UserName2 = "Username2"
# Getting the AD User objects, inkluding the MemberOf property
$userAccount1 = Get-ADUser -Identity $UserName1 -Properties MemberOf
@rysstad
rysstad / sp_who2_to_temp_table.sql
Created May 22, 2015 14:02
SQL Server: sp_who2 to temp table
-- MS SQL Server: sp_who2 to temp table
CREATE TABLE #temp_sp_who2 (
SPID INT,Status VARCHAR(255),
Login VARCHAR(255),
HostName VARCHAR(255),
BlkBy VARCHAR(255),
DBName VARCHAR(255),
Command VARCHAR(255),
CPUTime INT,
DiskIO INT,
@rysstad
rysstad / Get-RAMGb.ps1
Created May 22, 2015 13:59
Get physical RAM in Gb
# Get physical RAM in Gb
$physicalRAM = "{0:N0}" -f ((Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory / 1gb)
@rysstad
rysstad / my_VyOS_config
Created May 18, 2015 11:41
my VyOS config
configure
set interfaces ethernet eth0 address '10.20.25.2/24'
set interfaces ethernet eth0 description 'Outside'
set interfaces ethernet eth0 duplex 'auto'
set interfaces ethernet eth0 speed 'auto'
set interfaces ethernet eth1 address '192.168.1.1/24'
set interfaces ethernet eth1 description 'Inside'
set interfaces ethernet eth1 duplex 'auto'
set interfaces ethernet eth1 speed 'auto'
@rysstad
rysstad / Set-AllADUserPasswordNeverExpires.ps1
Created April 30, 2015 08:30
Set-AllADUserPasswordNeverExpires
# Set all AD user-account passwords to never expire.
# Use in test/dev-environments only! :-)
Get-ADUser -Filter * | Set-ADUser -PasswordNeverExpires:$true -Verbose
# Remove the "modern app" version of Skype. Tested on Win 10 preview.
Get-AppxPackage -Name Microsoft.SkypeApp | Remove-AppxPackage