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
#requires -version 3 | |
<# | |
.SYNOPSIS | |
Get-ProliantTemperatures - Get HP ProLiant temperature sensor readings and status for PRTG | |
.DESCRIPTION | |
Reads the status of HP ProLiant temperatures sensors via WMI and HP WBEM | |
and | |
http://www.hp.com/go/HPwbem |
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
<# | |
.SYNOPSIS | |
Migrate-OfficescanClient - Migrate Officescan clients to the correct server | |
.DESCRIPTION | |
Checks which server the Officescan client is pointing to (by reading ofcscan.ini) | |
If it's pointing to the wrong one, call the appropriate ipxfer command with | |
the correct parameters to point it to the new/correct server |
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
Import-Module sqlite | |
$scriptLocation = "C:\Scripts\Spiceworks-Geckoboard\" | |
$spiceworksDatabaseFilePath = "C:\Program Files (x86)\Spiceworks\db\spiceworks_prod.db" # Path to the SQLite database used by SpiceWorks | |
# Get all of the widget scripts | |
$allScripts = Get-ChildItem $scriptLocation -Filter "*.ps1" | |
# Mount the SpiceWorks database | |
mount-sqlite -name SpiceWorks -dataSource $spiceworksDatabaseFilePath |
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
$apikey = "paste in your API key here" | |
$geckoPushUrl = "paste in your push URL here" | |
# Get the count of open tickets from the database | |
$openTickets = Invoke-Item spiceworks: -sql 'select count() as "count" from tickets where status == "open"' | |
#Construct a here-string with the required json format | |
$jsonstream = @" | |
{ | |
"api_key":"APIKEY", |
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
$query = @" | |
select t.id as id,t.summary as summary,t.description as description,u.first_name || ' ' || u.last_name as name, round((julianday(date('now','localtime')) - julianday(t.created_at))) + 1 as days, t.category as category from tickets as t | |
inner join users as u on t.created_by = u.id | |
where status == 'open' | |
order by t.created_at desc | |
"@ | |
$apikey = "paste API key here" | |
$geckoPushUrl = "paste push URL here" |
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 the data, convert it to JSON | |
$jsonData = Invoke-WebRequest "https://data.cityofchicago.org/resource/ijzp-q8t2.json" | ConvertFrom-Json | |
# Filter our data set down to only the last month's crimes. Note that the data feed has a built-in lag of 7 days | |
$lastMonthsData = $jsonData | Where-Object {($_.date | get-date) -gt ((get-date).AddMonths(-1))} | |
# Show results, allowing user to select categories first and then view individual crimes | |
$lastMonthsData | Group-Object -Property primary_type | Sort-Object Count -Descending | Select-Object Name,Count,Group | Out-GridView -Title "Select a category (or multiple) to view details" -OutputMode Multiple | Select-Object -ExpandProperty Group | select primary_type,description,location_description,date,latitude,longitude,block,domestic,arrest,case_number | Sort-Object date -Descending | Out-GridView -Title "Crime Details" |
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
select distinct u.email as email, | |
u.first_name || ' ' || u.last_name as name, | |
u.title as job_title, | |
u.cell_phone as mobile, | |
u.office_phone as phone, | |
u.location as time_zone, | |
'en' as language | |
from users as u | |
inner join tickets as t on u.id = t.created_by | |
where (u.disabled is null) and ((u.first_name is not null) and (u.last_name is not null)) |
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
Function Get-AppLockerLogs { | |
$filter = ' | |
<QueryList> | |
<Query Id="0" Path="ForwardedEvents"> | |
<Select Path="ForwardedEvents">*[System[Provider[@Name="Microsoft-Windows-AppLocker"] and (Level=2 or Level=3)]]</Select> | |
</Query> | |
</QueryList> | |
' | |
$data = Get-WinEvent -FilterXml $filter -Oldest |
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
Function Create-X500ProxyAddressFromLegacyExchangeDN($Address) { | |
# As per https://support.microsoft.com/en-au/help/2807779/imceaex-non-delivery-report-when-you-send-email-messages-to-an-interna | |
$Address = $Address.Replace('_','/') # Replace any underscore character (_) with a slash character (/) | |
$Address = $Address.Replace('+20',' ') # Replace "+20" with a blank space | |
$Address = $Address.Replace('+28','(') # Replace "+28" with an opening parenthesis character | |
$Address = $Address.Replace('+29',')') # Replace "+29" with a closing parenthesis character. | |
$Address = $Address.Replace('IMCEAEX-','') # Delete the "IMCEAEX-" string | |
$Address = $Address.Split('@')[0] # Delete the "@mgd.domain.com" string | |
$Address = "X500:$Address" # Add "X500:" at the beginning | |
$Address |
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
$currentSettings = Get-WmiObject -Class Lenovo_BiosSetting -Namespace root\wmi -Filter 'CurrentSetting != ""' | Select-Object -ExpandProperty CurrentSetting | Sort-Object | |
$allSettings = @() | |
foreach ($setting in $currentSettings) { | |
# Check if Lenovo_GetBiosSelections exists. If not, we're running on a newer system that includes returns the possible values | |
# as part of the current setting value | |
$legacyMethodExists = Get-CimClass Lenovo_GetBiosSelections -Namespace root\wmi -ErrorAction SilentlyContinue -WarningAction SilentlyContinue | |
if ($legacyMethodExists) { |
OlderNewer