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
| # To prevent malfunction | |
| Param ([alias("-remove","r")][switch]$RemFrag) | |
| $KeepAppxPackages = @( | |
| "Microsoft.WindowsCalculator", | |
| "Microsoft.ScreenSketch" | |
| ) | |
| Write-Output "Start scripts." | |
| # Remove Privisioned Appx Packages |
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
| USE HVEVENT; | |
| DECLARE @OLD_DAY INT = -30 | |
| SELECT COUNT(*) FROM [dbo].[hv_event_data_historical] | |
| WHERE EventID | |
| IN ( | |
| SELECT EventID FROM [dbo].[hv_event_historical] WHERE Time < (DATEADD(day, @OLD_DAY, GETDATE())) | |
| ); | |
| SELECT COUNT(*) FROM [dbo].[hv_event_historical] | |
| WHERE Time < (DATEADD(day, @OLD_DAY, GETDATE())); |
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
| # Parameters | |
| $HostFile = $PSScriptRoot + "\hosts.txt" | |
| $LogFolder = $PSScriptRoot + "\logs" | |
| # Credential | |
| $Credential = Get-Credential | |
| #$SecureString = ConvertTo-SecureString "Password" -AsPlainText -Force | |
| #$Credential = New-Object System.Management.Automation.PsCredential "DOMAIN\Administrator", $SecureString | |
| # Import hosts list |
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
| # Parameters | |
| $HostFile = $PSScriptRoot + "\hosts.txt" | |
| $LogFolder = $PSScriptRoot + "\logs" | |
| # Main Routine | |
| $Credential = Get-Credential | |
| $HostList = Get-Content $HostFile | |
| if (!(Test-Path $LogFolder)) { |
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-ChildItem $Args[0] -Force -Recurse | ? { | |
| $_.Name -like "~*" -and $_.LastWriteTime -lt (Get-Date).AddDays(-1) ` | |
| -or $_.Name -like "*.tmp" ` | |
| -or $_.Name -like "._*" ` | |
| -or $_.Name -eq "Thumbs.db" ` | |
| -or $_.Name -eq ".DS_Store" ` | |
| } | Remove-Item -Force | |
| exit |
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-ConsoleWindowHandle { | |
| $Proc = Get-Process -Id $PID | |
| $i = 0 | |
| while ($Proc.MainWindowHandle -eq 0) { | |
| if ($i++ -gt 10) { | |
| return $null | |
| } | |
| $Proc = $Proc.Parent | |
| } | |
| return $Proc.MainWindowHandle |
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
| Dim objLocator, objConn, objProc | |
| Dim tmpRet, intPid, TargetHost, TargetUser, TargetPass | |
| TargetHost = Wscript.Arguments(0) | |
| TargetUser = Wscript.Arguments(1) | |
| TargetPass = Wscript.Arguments(2) | |
| WScript.Echo TargetHost & " --- " | |
| Set objLocator = WScript.CreateObject("WbemScripting.SWbemLocator") | |
| Set objConn = objLocator.ConnectServer(Targethost, "root\cimv2", TargetUser, TargetPass) |
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 | |
| SET REGFILE=%USERPROFILE%\default-printer.reg | |
| REG EXPORT "HKEY_CURRENT_USER\Software\Microsoft\Windows NT\CurrentVersion\Windows" %REGFILE% /y | |
| EXIT |
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
| # [通常使うプリンター]のエントリ退避 | |
| $RegkeyTemp = "HKCU:\PrinterTemp" | |
| $RegkeyWinNt = "HKCU:\Software\Microsoft\Windows NT\CurrentVersion\Windows" | |
| if (!(Test-Path -LiteralPath $RegKeyTemp)) { | |
| New-Item $RegkeyTemp | |
| } | |
| Copy-ItemProperty -LiteralPath $RegKeyWinNt -Name "Device" -Destination $RegKeyTemp |
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 | |
| SET TEMPKEY="HKCU\PrinterTemp" | |
| REG QUERY %TEMPKEY% | |
| IF ERRORLEVEL 1 goto SETKEY | |
| IF ERRORLEVEL 0 goto COPYVAL | |
| :SETKEY | |
| REG ADD %TEMPKEY% |
NewerOlder