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
| REM ElevationCheck | |
| whoami /groups | find "S-1-16-12288" > nul | |
| if "%errorlevel%"=="0" ( | |
| echo Running as elevated user. Continuing script. | |
| ) else ( | |
| echo Not running as elevated user. | |
| Pause | |
| goto :EOF | |
| ) |
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
| ##Requires -Version 2.0 | |
| function New-TrayNotifyIcon | |
| { | |
| param( | |
| [parameter(Mandatory=$false, ValueFromPipelineByPropertyName=$true)] | |
| [Alias('Icon')] | |
| $IconPath = "$env:windir\system32\WindowsPowerShell\v1.0\powershell.exe", | |
| [parameter(Mandatory=$True, ValueFromPipelineByPropertyName=$true)] | |
| $Title, |
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
| function Get-PrinterDriverFiles($ComputerName = '.') | |
| { | |
| $Win32_PrinterDriver = get-wmiobject -class 'Win32_PrinterDriver' -namespace 'root\CIMV2' -ComputerName $ComputerName | |
| ForEach ($Printer in $Win32_PrinterDriver) { | |
| $Printer.DependentFiles | ForEach-Object { | |
| [pscustomobject] @{ | |
| "Printer" = $Printer.Name | |
| "FullName" = $_ | |
| "Name" = Split-Path -Path $_ -Leaf |
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
| param( | |
| $ComputerList = ("$env:COMPUTERNAME"), | |
| $Cred = $(Get-Credential "$env:USERDOMAIN\$env:USERNAME") | |
| ) | |
| $Result1 = Invoke-Command -ComputerName $ComputerList -Credential $Cred -ScriptBlock { | |
| $Win32_OperatingSystem = Get-WmiObject -Class 'Win32_OperatingSystem' | |
| $LastBootUpTime = $Win32_OperatingSystem.ConvertToDateTime($Win32_OperatingSystem.LastBootUpTime) | |
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
| function Get-TSMClientEvents | |
| { | |
| Param( | |
| [Parameter(Mandatory=$true, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$true)] | |
| $ComputerName | |
| ) | |
| PROCESS | |
| { | |
| if ($ComputerName -is [Array]) | |
| { |
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
| function Get-TSMClientSchedule | |
| { | |
| Param( | |
| [Parameter(Mandatory=$true, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$true)] | |
| $ComputerName | |
| ) | |
| PROCESS | |
| { | |
| if ($ComputerName -is [Array]) | |
| { |
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
| @ECHO OFF | |
| if "%1" == "" goto error | |
| for /f "skip=1 tokens=3 usebackq" %%s in ( | |
| `query user %1%` | |
| ) do ( | |
| echo Setting %%s to console. | |
| %windir%\System32\tscon.exe %%s /dest:console | |
| ) |
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 Blade Position from WMI, requires HP providers installed. | |
| For /F "delims== tokens=1-2" %%c in ('wmic /namespace:\\root\HPQ Path HP_BladeCSLocation Get PhysicalPosition /format:value^|find "PhysicalPosition=" ') do set PhysicalPosition=%%d | |
| :: C7000 chassis has 16 slots, make sure it is not out of range. | |
| if NOT %PhysicalPosition% gtr 0 IF NOT %PhysicalPosition% lss 17 GOTO Invalid_Bay_Number | |
| :: Pad to 2 digits. | |
| if %PhysicalPosition% lss 10 set PhysicalPosition=0%PhysicalPosition% |
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
| :MPIO | |
| echo MPIO: Checking claimed BusTypes. | |
| SET MSFT_BUSTYPE_iSCSI=MSFT2005iSCSIBusType_0x9 | |
| FOR /f "tokens=* delims==" %%G IN ('mpclaim -h ^|find "%MSFT_BUSTYPE_iSCSI%"') DO SET FOUND_iSCSI=%%G | |
| mpclaim -h | |
| echo. | |
| if (%FOUND_iSCSI%) == ("%MSFT_BUSTYPE_iSCSI%") GOTO MPIO_Complete | |
| :MPIO_Claim |
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
| function Get-ExternalIP | |
| { | |
| $URL = 'http://ifconfig.me/all.xml' | |
| $ProxyURL = [System.Net.WebRequest]::GetSystemWebProxy().GetProxy($URL).AbsoluteUri | |
| $resp = Invoke-WebRequest -Uri $URL -Method Get -Proxy $ProxyURL -ProxyUseDefaultCredentials | |
| $([xml]$resp).info.ip_addr | |
| } | |
| function Test-InternetConnection |