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
$TranscriptFile = $env:TEMP + "\PowershellTranscript-" + (Get-Date -Format yyyy-MM-dd_HH-mm).ToString() + ".log" | |
Start-Transcript $TranscriptFile -Verbose |
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
$hostnameFQDN = [System.Net.Dns]::GetHostByName(($env:computerName)).HostName |
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
################################################################################ | |
# PowershellGenerateRandomPassword | |
# | |
# Description: Generate random password consisting of only upper and lower case letters and numbers. | |
# Adding non-letter characters would increase the password complexity, but would add | |
# potential problems related to SQL server, ODBC etc. | |
# | |
# Author name: Tor Arne Rysstad | |
# Created date: 2013.10.29 | |
# Version: 0.02 |
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
Get-WMIObject Win32_LogicalDisk | ForEach-Object {Write-Host $_.DeviceID "Size: " ("{0:N2}" -f ($_.Size / 1GB)) "Gb `t Free:" ("{0:N2}" -f ($_.freespace / 1GB)) "Gb" } |
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
# Create object reference to Get-Host | |
$pshost = get-host | |
# create reference to the console’s UI.RawUI child object | |
$pswindow = $pshost.ui.rawui | |
# Adjust the buffer first: | |
$newsize = $pswindow.buffersize | |
$newsize.height = 9999 | |
$newsize.width = 200 | |
$pswindow.buffersize = $newsize | |
# Adjust the Window size |
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
$PrinterPath = "\\printerServer\printerShare" | |
$PrinterName = "PrinterName" | |
$wmiNet = new-Object -com WScript.Network | |
$wmiNet.AddWindowsPrinterConnection($PrinterPath) | |
# Set as default | |
(New-Object -ComObject WScript.Network).SetDefaultPrinter($PrinterName) | |
# List all printers | |
# (New-Object -ComObject WScript.Network).EnumPrinterConnections() |
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
(Get-Date -Format yyyy-MM-dd_HH-mm).ToString() |
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
Get-ChildItem | Select-Object Name,LastWriteTime,@{Name="Size Mb"; Expression = {[math]::round($_.Length /1Mb, 2)}} |
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
; Turn on NumLock for ever and always... aahh... | |
SetNumLockState, AlwaysOn |
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
::dt--:: | |
FormatTime, dateTime2, ,yyyy.MM.dd-HH.mm | |
SendInput %dateTime2% | |
return |
OlderNewer