This file contains hidden or 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
# Run first manual full backup (next run will automaticaly be incremental) | |
duplicity full /data/documents azure://storagecontainer001 --log-file /data/duplicity.log | |
# Run manual backup job in background | |
duplicity full /data/documents azure://storagecontainer001 --log-file /data/duplicity.log | |
# (press ctrl+Z) | |
disown -h %1 | |
bg 1 | |
logout |
This file contains hidden or 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
# Schedule cron job to backup every 5 minutes after midnight | |
# Create a backup_script.sh with "crontab -e" | |
export AZURE_ACCOUNT_NAME=storageaccount001 | |
export AZURE_ACCOUNT_KEY='KEYHERE' | |
export PASSPHRASE='NEWRPRIVATEPASSWORDHERE' | |
duplicity full /data/documents azure://storagecontainer001 | |
unset PASSPHRASE |
This file contains hidden or 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
#Check TPM Chip locally on Windows 10 PC with the following Powershell Script: | |
# Creating a variable for TPM WMI object. | |
$Tpm = Get-wmiobject -Namespace ROOT\CIMV2\Security\MicrosoftTpm -Class Win32_Tpm | |
# Query if TPM enabled (True/False) | |
$Tpm.IsEnabled().isenabled | |
This file contains hidden or 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
#Clear, Enable and Activate TPM | |
#First, we have to load the WMI class into a variable: | |
$Tpm = Get-wmiobject -Namespace ROOT\CIMV2\Security\MicrosoftTpm -Class Win32_Tpm | |
#Then, a one liner to Clear, Enable and Activate TPM: | |
$Tpm.SetPhysicalPresenceRequest(14) |
This file contains hidden or 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
# Create a variable that searches Active Directory for Computers with Windows 10 Operating system. | |
$Win10 = Get-ADComputer -Filter {OperatingSystem -like "*10*"} ` | |
-Properties Name, DNSHostName, OperatingSystem, ` | |
OperatingSystemServicePack, OperatingSystemVersion, PasswordLastSet, ` | |
whenCreated, whenChanged, LastLogonTimestamp, nTSecurityDescriptor, ` | |
DistinguishedName | | |
Select-Object Name, DNSHostName, OperatingSystem, ` | |
OperatingSystemServicePack, OperatingSystemVersion, PasswordLastSet, ` | |
whenCreated, whenChanged, ` |
This file contains hidden or 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
Get-WMIObject Win32_PerfFormattedData_Spooler_PrintQueue | | |
Select Name, @{Expression={$_.jobs};Label="CurrentJobs"}, TotalJobsPrinted, JobErrors |
This file contains hidden or 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
#creates a variable | |
$SVRNAME = 'server1.contoso.com' | |
#get service status | |
gsv -ComputerName $SVRNAME -Name Spooler | |
#stop service | |
(gsv -ComputerName $SVRNAME -Name Spooler).stop() | |
#start service |
This file contains hidden or 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
<# | |
.Synopsis | |
Get systeminfo on remote computer | |
.Description | |
These commands save your administrator credentials in a variable and make use of invoke command to run systeminfo on a remote computer | |
#> | |
$cred = Get-Credential | |
Invoke-Command –ScriptBlock {systeminfo} –ComputerName computer1.contoso.com -Credential $cred |
This file contains hidden or 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
# All credit goes to http://techibee.com/powershell/powershell-query-windows-service-start-time/1336 | |
# | |
# This script displays the start date and time of a windows service | |
# Usage examples: | |
# .\Get-ServiceStartTime.ps1 -ComputerName “mytestpc1” -Name spooler | |
# .\Get-ServiceStartTime.ps1 -ComputerName “mytestpc1”, “mytestpc2” -Name spooler | |
# | |
[cmdletbinding()] |
This file contains hidden or 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
# this powershell code lists all poweroff and restart events from the Windows EventLog | |
Get-WinEvent -FilterHashtable @{logname='System'; id=1074} | ForEach-Object { | |
$rv = New-Object PSObject | Select-Object Date, User, Action, Process, Reason, ReasonCode, Comment | |
$rv.Date = $_.TimeCreated | |
$rv.User = $_.Properties[6].Value | |
$rv.Process = $_.Properties[0].Value | |
$rv.Action = $_.Properties[4].Value | |
$rv.Reason = $_.Properties[2].Value | |
$rv.ReasonCode = $_.Properties[3].Value |