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
Start-Process -FilePath "${env:Windir}\System32\SFC.EXE" -ArgumentList '/scannow' -Wait -Verb RunAs | |
Repair-WindowsImage -Online -scanhealth | |
Repair-WindowsImage -Online -checkhealth | |
if ($ComputerProperties = Repair-WindowsImage -Online -checkhealth | Select-Object ImageHealthState | Where-Object {($_.ImageHealthState -notlike "Healthy")}) { | |
Repair-WindowsImage -Online -RestoreHealth} | |
Start-Process -FilePath "${env:Windir}\System32\SFC.EXE" -ArgumentList '/scannow' -Wait -Verb RunAs |
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
#CSV example name, username | |
# Import AD Module | |
import-module ActiveDirectory | |
# Import CSV | |
$MoveList = Import-Csv -Path "C:\temp\moveusers.csv" | |
# Specify target OU.This is where users will be moved. | |
$TargetOU = "OU=moveou,OU=users,DC=subdomain,DC=local" | |
# Import the data from CSV file and assign it to variable |
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
$User = gwmi win32_computersystem -Property Username | |
$UserName = $User.UserName | |
$UserSplit = $User.UserName.Split("\") | |
$OneDrive = "$env:SystemDrive\users\" + $UserSplit[1] +"\appdata\local\microsoft\onedrive\onedrive.exe" | |
# Parameter to Log | |
if ((test-path "$OneDrive") -and ((Get-Item $OneDrive).VersionInfo.FileVersion -gt '19')) | |
{ | |
Write-Host "Installed" | |
} | |
Else |
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
if( ( (test-path 'C:\windows.old','C:\$WINDOWS.~BT','C:\$Windows.~WS') -eq $true).Count -and (test-path 'C:\windows.old','C:\$WINDOWS.~BT','C:\$Windows.~WS' -OlderThan (Get-Date).AddHours(-10) )){ | |
& cscript /nologo "$dirfiles\AutomatedDiskCleanup.vbs" | |
} | |
If (Test-Path -LiteralPath 'C:\$WINDOWS.~BT') { | |
Remove-Item 'C:\$WINDOWS.~BT' -Recurse -Force | |
Write-Log -Message 'C:\$WINDOWS.~BT deleted' -Source $deployAppScriptFriendlyName | |
} | |
If (Test-Path -LiteralPath 'C:\$Windows.~WS') { |
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
if( ( (test-path 'C:\windows.old','C:\$WINDOWS.~BT','C:\$Windows.~WS') -eq $true).Count -and (test-path 'C:\windows.old','C:\$WINDOWS.~BT','C:\$Windows.~WS' -OlderThan (Get-Date).AddHours(-10) )) | |
{ | |
} | |
else | |
{ | |
Write-Host "Installed" | |
} |
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
#Remove from user folder | |
$UserDir = "C:\Users" | |
$Folders = Get-ChildItem -Path $UserDir | |
ForEach ($Folder in $Folders) | |
{ | |
if (Test-Path "$Userdir\$folder\AppData\Local\Mozilla Firefox\uninstall\helper.exe") | |
{ | |
Execute-Process -Path "$Userdir\$folder\AppData\Local\Mozilla Firefox\uninstall\helper.exe" -Parameters '-ms' -ContinueOnError $True | |
} | |
} |
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 ADFS | |
Add-ADFSRelyingPartyTrust -Name "Amazon Web Services & AD Groups" -MetadataURL "https://signin.aws.amazon.com/static/saml-metadata.xml" -MonitoringEnabled:$true -AutoUpdateEnabled:$true | |
$ruleSet = New-AdfsClaimRuleSet -ClaimRuleFile ((pwd).Path + "\claims-AD-Groups.txt") | |
$authSet = New-AdfsClaimRuleSet -ClaimRuleFile ((pwd).Path + "\auth.txt") | |
Set-AdfsRelyingPartyTrust -TargetName "Amazon Web Services & AD Groups" -IssuanceTransformRules $ruleSet.ClaimRulesString -IssuanceAuthorizationRules $authSet.ClaimRulesString |
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 CSV file, commas as separators, headers are Path, Username | |
$Csv = Import-Csv C:\temp\file.csv | |
#Separate headers | |
foreach ($Line in $Csv) { | |
#Separate Path header for old user home folder | |
$UserHome_old = $Line.Path | |
#Separate Username header for new home folder location |