Upload files to "/"
This commit is contained in:
commit
b8fcca01a5
11
Add-ADOUToGroup.ps1
Normal file
11
Add-ADOUToGroup.ps1
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
# Takes all the users from an OU and adds them to a group.
|
||||||
|
|
||||||
|
$OUName = "" # Name of the OU
|
||||||
|
$GroupName = "" # Name of the Group
|
||||||
|
|
||||||
|
$OU = Get-ADOrganizationalUnit -Filter "Name -like '$OUName'" -Properties DistinguishedName
|
||||||
|
$OUPath = $OU.DistinguishedName
|
||||||
|
|
||||||
|
$Users = Get-ADUser -Filter * -SearchBase $OUPath | Select-Object
|
||||||
|
|
||||||
|
Add-ADGroupMember -Identity $GroupName -Members $Users
|
10
Check-PageFile.ps1
Normal file
10
Check-PageFile.ps1
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
# Checks if the page file is at 90% capacity
|
||||||
|
|
||||||
|
$AutoManaged = (Get-CimInstance Win32_ComputerSystem).AutomaticManagedPagefile
|
||||||
|
if ($AutoManaged -eq $false){Write-Host "Page file is not Automatically managed by Windows"; exit 0}
|
||||||
|
|
||||||
|
$page = Get-CimInstance Win32_PageFileUsage -Property *
|
||||||
|
|
||||||
|
$threshold = ($page.AllocatedBaseSize * (9/10))
|
||||||
|
if ($page.CurrentUsage -gt $threshold){"Page File Threshold reached"; exit 1}
|
||||||
|
else {"Page File Threshold NOT Reached"; exit 0}
|
9
Copy-LatestFile.ps1
Normal file
9
Copy-LatestFile.ps1
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Looks at the latest file in a given directory and then copies it to a second given directory.
|
||||||
|
|
||||||
|
$targetPath = "" # Source directory
|
||||||
|
$outputPath = "" # Output directory
|
||||||
|
|
||||||
|
Set-Location $targetPath
|
||||||
|
$latestFile = (Get-ChildItem -Path $targetPath -Attributes !Directory | Sort-Object -Descending -Property LastWriteTime | Select-Object -First 1)
|
||||||
|
|
||||||
|
Copy-Item -Path $latestFile -Destination $outputPath
|
32
Delete-Temp&Sage200Folder.ps1
Normal file
32
Delete-Temp&Sage200Folder.ps1
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
#Sets Execution Policy to allow script to run
|
||||||
|
Set-ExecutionPolicy -Scope CurrentUser -Force Unrestricted -Confirm:$False
|
||||||
|
|
||||||
|
#start-sleep -Seconds 10
|
||||||
|
|
||||||
|
#Sets current user name to varible, converts to string, finds index of "\", adds 1 to get the index of the first character in name
|
||||||
|
$user = [System.Security.Principal.WindowsIdentity]::GetCurrent().Name
|
||||||
|
$user.ToString()
|
||||||
|
$i = $user.IndexOf("\")
|
||||||
|
$i+=1
|
||||||
|
|
||||||
|
#Creates blank string varible
|
||||||
|
$userNew = ""
|
||||||
|
|
||||||
|
#For loop to start at the index of first character of username and end at the length of the username
|
||||||
|
for ($i; $i -lt $user.Length; $i++)
|
||||||
|
{
|
||||||
|
$userNew = $userNew + $user[$i] #adds the indexed character to new varible
|
||||||
|
}
|
||||||
|
|
||||||
|
$userNew
|
||||||
|
|
||||||
|
$TempFolder = "C:\Users\"+$userNew+"\AppData\Local\Temp\"
|
||||||
|
$SageFolder = "C:\Users\"+$userNew+"\AppData\Local\Sage\Sage200\"
|
||||||
|
Get-ChildItem $TempFolder | Remove-Item -Recurse -Force
|
||||||
|
Get-ChildItem $SageFolder | Remove-Item -Recurse -Force
|
||||||
|
|
||||||
|
#start-sleep -Seconds 10
|
||||||
|
|
||||||
|
Set-ExecutionPolicy -Scope CurrentUser -Force Undefined -Confirm:$False
|
||||||
|
|
||||||
|
#start-sleep -Seconds 20
|
40
Detect-VSS.ps1
Normal file
40
Detect-VSS.ps1
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
# Detects various states of Volume Shadow Copies, Disabled, Enabled with Default schedule, Enabled with custom schedule and Enabled with custom schedule ensuring all disks are enabled.
|
||||||
|
|
||||||
|
$ScheduledTasks = Get-ScheduledTask -TaskName "ShadowCopy*"
|
||||||
|
$DefaultTasks = Get-ScheduledTask -TaskName "ShadowCopyVolume{*}"
|
||||||
|
$CustomTasks = Get-ScheduledTask -TaskName "ShadowCopy * drive"
|
||||||
|
|
||||||
|
$CustomTaskLetters = ForEach ($task in $CustomTasks){$task.TaskName[11]}
|
||||||
|
|
||||||
|
$VSS = [PSCustomObject]@{
|
||||||
|
enabled = $false
|
||||||
|
type = $null
|
||||||
|
}
|
||||||
|
|
||||||
|
$Disks = Get-Volume | Where-Object {$_.DriveType -eq "Fixed"} | Where-Object {$_.DriveLetter -ne $null} | Where-Object {$_.Size -gt 5GB}
|
||||||
|
|
||||||
|
$MissingDrives = ForEach ($letter in $Disks.DriveLetter){if ($letter -notin $CustomTaskLetters){$letter}}
|
||||||
|
|
||||||
|
#No Tasks
|
||||||
|
if ($ScheduledTasks -eq $null)
|
||||||
|
{Write-Host "No VSS Tasks"}
|
||||||
|
#Default Tasks
|
||||||
|
elseif ($DefaultTasks.State -ne "Disabled")
|
||||||
|
{Write-Host "Default VSS Tasks Enabled"; $VSS.enabled = $true; $VSS.type = "Default"}
|
||||||
|
#Default Tasks Disabled and No Custom Tasks
|
||||||
|
if (($DefaultTasks.State -eq "Disabled") -and ($CustomTasks -eq $null))
|
||||||
|
{Write-Host "Default VSS Tasks Disabled and NO Custom VSS Tasks"; $VSS.enabled = $false; $VSS.type = "Default"}
|
||||||
|
#Default Tasks Disabled and Custom Tasks Enabled
|
||||||
|
if ((($DefaultTasks.State -eq "Disabled") -or ($DefaultTasks -eq $null)) -and ($CustomTasks -ne $null))
|
||||||
|
{Write-Host "Default VSS Tasks Disabled and Custom VSS Tasks Enabled"; $VSS.enabled = $true; $VSS.type = "Custom"}
|
||||||
|
#Default Tasks Disabled and Custom Tasks Enabled, but not all drives have been enabled
|
||||||
|
if ($MissingDrives -ne $null)
|
||||||
|
{Write-Host "Default VSS Tasks Disabled and Custom VSS Tasks Enabled, But Not all Drives are Enabled"; $VSS.enabled = $true; $VSS.type = "Custom, Incomplete"}
|
||||||
|
|
||||||
|
|
||||||
|
if ($Host.Version.Major -gt 4){Write-Host $VSS}
|
||||||
|
elseif ($Host.Version.Major -lt 5){$VSS}
|
||||||
|
|
||||||
|
if ($VSS.enabled -eq $false){exit 1}
|
||||||
|
elseif ($VSS.type -ne "Custom"){exit 2}
|
||||||
|
else{exit 0}
|
Loading…
x
Reference in New Issue
Block a user