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
| #This script installs SCOM agents to several clients. | |
| # | |
| #ex) | |
| #.\Install-SCOMAgent.ps1 -ServerName scomserver.domain.name -Targets @("client1.domain.name", "client2.domain.name") | |
| Param( | |
| [parameter(mandatory=$true)]$ServerName, | |
| [parameter(mandatory=$true)]$Targets | |
| ) |
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
| $p = Get-CimInstance -Name root\cimv2\power -Class win32_PowerPlan -Filter "ElementName = '高パフォーマンス'" | |
| Invoke-CimMethod -InputObject $p[0] -MethodName Activate |
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
| #test |
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
| do while WScript.Arguments.Count=0 and WScript.Version>=5.7 | |
| 'Run this script as admin. | |
| Set sha=CreateObject("Shell.Application") | |
| sha.ShellExecute "wscript.exe",""""+WScript.ScriptFullName+""" uac","","runas" | |
| WScript.Quit | |
| loop | |
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 | |
| ( | |
| [String]$Path = (Get-Location) | |
| ) | |
| # Elevate | |
| Write-Host "Checking for elevation... " -NoNewline | |
| $CurrentUser = New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent()) | |
| if (($CurrentUser.IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) -eq $false) { | |
| ArgumentList = "-noprofile -noexit -file `"{0}`" -Path `"$Path`"" |
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
| require 'flickraw' | |
| FlickRaw.api_key="" | |
| FlickRaw.shared_secret="" | |
| flickr.access_token = "" | |
| flickr.access_secret = "" | |
| # From here you are logged: | |
| login = flickr.test.login |
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
| workflow StopAllVMs | |
| { | |
| $azureCredential = Get-AutomationPSCredential -Name "Default Automation Credential" | |
| # Connect to Azure | |
| Add-AzureAccount -Credential $azureCredential | Write-Verbose | |
| # Select the Azure subscription | |
| $SubscriptionName = 'xxx Subscription Name xxx' | |
| Select-AzureSubscription -SubscriptionName $SubscriptionName |
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
| #---------------------------------------------------------- | |
| #設定 | |
| #---------------------------------------------------------- | |
| #スクリプトパス | |
| $scriptPath = "" | |
| #サブスクリプション名 | |
| $subscriptionName = "" | |
| #リージョン |
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
| $users = Get-ADUser -Filter * -Properties displayNamePrintable, DisplayName, mail | |
| $displayNamePrintables = $users.displayNamePrintable | |
| $duplicateUsers = $displayNamePrintables | Where-Object {if(($displayNamePrintables -eq $_).count -ge 2){$_}} | Sort-Object | Get-Unique | |
| Write-Output "表示名 `t DisplayNamePrintable `t メールアドレス" | |
| foreach($user in $users) | |
| { | |
| $duplicateUsers | ForEach-Object { | |
| if($user.displayNamePrintable -eq $_) |
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
| # Exchange OnlineへのPowerShell接続(※多要素認証には非対応) | |
| # | |
| # 1. O365組織の管理者のIDとパスワードを生で記載する | |
| # 2. 管理者として実行したPowerShellに貼り付ける | |
| # 3. 作業する | |
| # 4. 作業が終わったら Remove-Session $Session を実行する | |
| # | |
| # 参考:https://docs.microsoft.com/ja-jp/powershell/exchange/exchange-online/connect-to-exchange-online-powershell/connect-to-exchange-online-powershell?view=exchange-ps | |
| Set-ExecutionPolicy RemoteSigned |