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
| #!/usr/bin/python | |
| # -*- coding: <utf-8> -*- | |
| from __future__ import print_function | |
| import datetime | |
| dDate = datetime.datetime.now().strftime("%m/%d/%Y %I:%M:%S %p") | |
| dDate2 = datetime.datetime.now().strftime("%m-%d-%Y_%I%M%S%p") | |
| location = "C:/temp/" |
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
| Add-Content -Path $Profile -Value 'Import-Module "C:\Program Files (x86)\SomeProduct\PowerShell\ProductModule.psd1"' -Force |
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
| $arrShutdown = Get-EventLog -LogName System -EntryType Information -InstanceId 2147484722 | sort-object $_.Time -descending | |
| foreach ($item in $arrShutdown) | |
| { | |
| $UserName = $item.UserName | |
| $Message = $item.Message | |
| $Time = $item.TimeGenerated | |
| write-host "UserName `t:$username `nTime `t`t:$time `nMessage `t:$Message `n`n" | |
| } |
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_operatingsystem | select @{LABEL="LastBootUpTime";EXPRESSION={$_.ConverttoDateTime($_.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
| Set-AuthenticodeSignature SCRIPT @(Get-ChildItem cert:\CurrentUser\My -codesign)[0] |
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-Content (read-host "Enter Path to logfile") -wait |
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
| # Nutanix | |
| #open Powershell x86 | |
| #%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe | |
| #Add Nutanix Snappin | |
| Add-PsSnapin NutanixCmdletsPSSnapin | |
| Connect-NutanixCluster -server $objNutanixBlockIP -AcceptInvalidSSLCerts | |
| # SCCM | |
| cd (Drive of Install) |
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 | |
| Checks services and identifies all services that need to be running. | |
| Attempts to restart if they are not running. Reports on success and failures | |
| .DESCRIPTION | |
| This script runs through all services and fixes services that should be running. | |
| Du to space limitations it has currently only got faulty services enabled for logging. | |
| Upon trying to restart the service 3 times and failing it will report the service down. | |
| Down will report NOK, up OK and remediated Fixed. | |
| Due to the number fo services Faulty services by default are enabled in one file. |
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-CimInstance Win32_GroupUser | where {$_.GroupComponent -like "*admini*"} |select -ExpandProperty PartComponent |
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
| [string]::Compare($a, $b, $True) | |
| $a.StartsWith("Script") | |
| $a.EndsWith("Script") | |
| $a.ToLower() | |
| $a.ToUpper() | |
| $d.ToLower() | |
| $a.trim() |