tweaking wip scripts
This commit is contained in:
parent
57129cf934
commit
a6f7e446de
|
@ -1,18 +0,0 @@
|
||||||
# Needs to be parameterized: $icofile, $URL, $ShortcutPath
|
|
||||||
# Need to change paths and test/create if don't exist
|
|
||||||
|
|
||||||
|
|
||||||
wget "https://www.example.com/logos/example.ico" -outfile "c:\agent\example.ico"
|
|
||||||
|
|
||||||
$WshShell = New-Object -comObject WScript.Shell
|
|
||||||
$path = "C:\Users\All Users\desktop\example.url"
|
|
||||||
$targetpath = "https://example.com/"
|
|
||||||
$iconlocation = "c:\agent\example.ico"
|
|
||||||
$iconfile = "IconFile=" + $iconlocation
|
|
||||||
$Shortcut = $WshShell.CreateShortcut($path)
|
|
||||||
$Shortcut.TargetPath = $targetpath
|
|
||||||
$Shortcut.Save()
|
|
||||||
Add-Content $path "HotKey=0"
|
|
||||||
Add-Content $path "$iconfile"
|
|
||||||
Add-Content $path "IconIndex=0"
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
REM Print Spooler reset script. Will stop spooler, fix permissions on print folders, clear all files in print queues, and restart spooler service.
|
||||||
|
|
||||||
REM Stop Print Spooler
|
REM Stop Print Spooler
|
||||||
net stop "Spooler"
|
net stop "Spooler"
|
||||||
|
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
net stop "Print Spooler"
|
|
||||||
net start "Print Spooler"
|
|
|
@ -0,0 +1,25 @@
|
||||||
|
<#
|
||||||
|
.Synopsis
|
||||||
|
Restart Print Spooler Service
|
||||||
|
.DESCRIPTION
|
||||||
|
Will force-restart the spooler service. With additional command parameter will also delete any pending print jobs
|
||||||
|
.EXAMPLE
|
||||||
|
Another example of how to use this cmdlet
|
||||||
|
.OUTPUTS
|
||||||
|
Any print jobs that are deleted
|
||||||
|
.NOTES
|
||||||
|
v1.0 5/2021
|
||||||
|
https://github.com/silversword411
|
||||||
|
.FUNCTIONALITY
|
||||||
|
Print Spooler Troubleshooting, restarts spooler service. Can also delete all print jobs that are pending
|
||||||
|
#>
|
||||||
|
|
||||||
|
#Restart Spooler service
|
||||||
|
Restart-Service -Name spooler -Force
|
||||||
|
|
||||||
|
#Deletes All print jobs within the last 15 years
|
||||||
|
$PrintJobs = get-wmiobject -class "Win32_PrintJob" -namespace "root\CIMV2" -computername . | Where-Object { [System.Management.ManagementDateTimeConverter]::ToDateTime($_.TimeSubmitted) -lt (Get-Date).AddDays(-5500) }
|
||||||
|
foreach ($job in $PrintJobs) {
|
||||||
|
# Write-Host "Canceling job $($job.JobId)"
|
||||||
|
$job.Delete()
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
#Update with command parameters
|
|
||||||
#Deletes All print jobs within the last 2 days
|
|
||||||
|
|
||||||
$PrintJobs = get-wmiobject -class "Win32_PrintJob" -namespace "root\CIMV2" -computername . | Where-Object { [System.Management.ManagementDateTimeConverter]::ToDateTime($_.TimeSubmitted) -lt (Get-Date).AddDays(-2) }
|
|
||||||
foreach ($job in $PrintJobs) {
|
|
||||||
# Write-Host "Canceling job $($job.JobId)"
|
|
||||||
$job.Delete()
|
|
||||||
}
|
|
|
@ -1,7 +1,9 @@
|
||||||
md -Path 'C:\agent' -Force
|
|
||||||
wget "http://www.yourwebsite.com/logos/yourico.ico" -outfile "c:\agent\yourico.ico"
|
|
||||||
|
mkdir -Path 'C:\agent' -Force
|
||||||
|
Invoke-WebRequest "http://www.yourwebsite.com/logos/yourico.ico" -outfile "c:\agent\yourico.ico"
|
||||||
$WshShell = New-Object -comObject WScript.Shell
|
$WshShell = New-Object -comObject WScript.Shell
|
||||||
$path = "C:\Users\All Users\desktop\Jaxsupport.url"
|
$path = "C:\Users\All Users\desktop\Shortcut.url"
|
||||||
$targetpath = "https://yourwebsite.com"
|
$targetpath = "https://yourwebsite.com"
|
||||||
$iconlocation = "c:\agent\yourico.ico"
|
$iconlocation = "c:\agent\yourico.ico"
|
||||||
$iconfile = "IconFile=" + $iconlocation
|
$iconfile = "IconFile=" + $iconlocation
|
||||||
|
|
Loading…
Reference in New Issue