Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Function Start-Cleanup {
  2. <#
  3. .SYNOPSIS
  4.    Automate cleaning up a C:\ drive with low disk space
  5.  
  6. .DESCRIPTION
  7.    Cleans the C: drive's Window Temperary files, Windows SoftwareDistribution folder,
  8.    the local users Temperary folder, IIS logs(if applicable) and empties the recycling bin.
  9.    All deleted files will go into a log transcript in $env:TEMP. By default this
  10.    script leaves files that are newer than 7 days old however this variable can be edited.
  11.  
  12. .EXAMPLE
  13.    PS C:\> .\Start-Cleanup.ps1
  14.    Save the file to your hard drive with a .PS1 extention and run the file from an elavated PowerShell prompt.
  15.  
  16. .NOTES
  17.    This script will typically clean up anywhere from 1GB up to 15GB of space from a C: drive.
  18.  
  19. .FUNCTIONALITY
  20.    PowerShell v3+
  21. #>
  22.  
  23. ## Allows the use of -WhatIf
  24. [CmdletBinding(SupportsShouldProcess=$True)]
  25.  
  26. param(
  27.     ## Delete data older then $daystodelete
  28.     [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,Position=0)]
  29.     $DaysToDelete = 7,
  30.  
  31.     ## LogFile path for the transcript to be written to
  32.     [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,Position=1)]
  33.     $LogFile = ("$env:TEMP\" + (get-date -format "MM-d-yy-HH-mm") + '.log'),
  34.  
  35.     ## All verbose outputs will get logged in the transcript($logFile)
  36.     [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,Position=2)]
  37.     $VerbosePreference = "Continue",
  38.  
  39.     ## All errors should be withheld from the console
  40.     [Parameter(Mandatory=$false,ValueFromPipelineByPropertyName=$true,Position=3)]
  41.     $ErrorActionPreference = "SilentlyContinue"
  42. )
  43.  
  44.     ## Begin the timer
  45.     $Starters = (Get-Date)
  46.    
  47.     ## Check $VerbosePreference variable, and turns -Verbose on
  48.     Function global:Write-Verbose ( [string]$Message ) {
  49.         if ( $VerbosePreference -ne 'SilentlyContinue' ) {
  50.             Write-Host "$Message" -ForegroundColor 'Green'
  51.         }
  52.     }
  53.  
  54.     ## Tests if the log file already exists and renames the old file if it does exist
  55.     if(Test-Path $LogFile){
  56.         ## Renames the log to be .old
  57.         Rename-Item $LogFile $LogFile.old -Verbose -Force
  58.     } else {
  59.         ## Starts a transcript in C:\temp so you can see which files were deleted
  60.         Write-Host (Start-Transcript -Path $LogFile) -ForegroundColor Green
  61.     }
  62.  
  63.     ## Writes a verbose output to the screen for user information
  64.     Write-Host "Retriving current disk percent free for comparison once the script has completed.                 " -NoNewline -ForegroundColor Green
  65.     Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  66.  
  67.     ## Gathers the amount of disk space used before running the script
  68.     $Before = Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DriveType -eq "3" } | Select-Object SystemName,
  69.     @{ Name = "Drive" ; Expression = { ( $_.DeviceID ) } },
  70.     @{ Name = "Size (GB)" ; Expression = {"{0:N1}" -f ( $_.Size / 1gb)}},
  71.     @{ Name = "FreeSpace (GB)" ; Expression = {"{0:N1}" -f ( $_.Freespace / 1gb ) } },
  72.     @{ Name = "PercentFree" ; Expression = {"{0:P1}" -f ( $_.FreeSpace / $_.Size ) } } |
  73.         Format-Table -AutoSize |
  74.         Out-String
  75.  
  76.     ## Stops the windows update service so that c:\windows\softwaredistribution can be cleaned up
  77.     Get-Service -Name wuauserv | Stop-Service -Force -ErrorAction SilentlyContinue -WarningAction SilentlyContinue -Verbose
  78.  
  79.     # Sets the SCCM cache size to 1 GB if it exists.
  80.     if ((Get-WmiObject -namespace root\ccm\SoftMgmtAgent -class CacheConfig) -ne "$null"){
  81.         # if data is returned and sccm cache is configured it will shrink the size to 1024MB.
  82.         $cache = Get-WmiObject -namespace root\ccm\SoftMgmtAgent -class CacheConfig
  83.         $Cache.size = 1024 | Out-Null
  84.         $Cache.Put() | Out-Null
  85.         Restart-Service ccmexec -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
  86.     }
  87.  
  88.     ## Deletes the contents of windows software distribution.
  89.     Get-ChildItem "C:\Windows\SoftwareDistribution\*" -Recurse -Force -ErrorAction SilentlyContinue | Remove-Item -recurse -ErrorAction SilentlyContinue -Verbose
  90.     Write-Host "The Contents of Windows SoftwareDistribution have been removed successfully!                      " -NoNewline -ForegroundColor Green
  91.     Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  92.  
  93.     ## Disable hibernation file
  94.     powercfg.exe -h off
  95.  
  96.     ## Deletes the contents of the Windows Temp folder.
  97.     Get-ChildItem "C:\Windows\Temp\*" -Recurse -Force -Verbose -ErrorAction SilentlyContinue |
  98.         Where-Object { ($_.CreationTime -lt $(Get-Date).AddDays( - $DaysToDelete)) } | Remove-Item -force -recurse -ErrorAction SilentlyContinue -Verbose
  99.     Write-host "The Contents of Windows Temp have been removed successfully!                                      " -NoNewline -ForegroundColor Green
  100.     Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  101.  
  102.  
  103.     ## Deletes all files and folders in user's Temp folder older then $DaysToDelete
  104.     Get-ChildItem "C:\users\*\AppData\Local\Temp\*" -Recurse -Force -ErrorAction SilentlyContinue |
  105.         Where-Object { ($_.CreationTime -lt $(Get-Date).AddDays( - $DaysToDelete))} |
  106.         Remove-Item -force -recurse -ErrorAction SilentlyContinue -Verbose
  107.     Write-Host "The contents of `$env:TEMP have been removed successfully!                                         " -NoNewline -ForegroundColor Green
  108.     Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  109.  
  110.     ## Removes all files and folders in user's Temporary Internet Files older then $DaysToDelete
  111.     Get-ChildItem "C:\users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\*" `
  112.         -Recurse -Force -Verbose -ErrorAction SilentlyContinue |
  113.         Where-Object {($_.CreationTime -lt $(Get-Date).AddDays( - $DaysToDelete))} |
  114.         Remove-Item -Force -Recurse -ErrorAction SilentlyContinue -Verbose
  115.     Write-Host "All Temporary Internet Files have been removed successfully!                                      " -NoNewline -ForegroundColor Green
  116.     Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  117.  
  118.     ## Removes *.log from C:\windows\CBS
  119.     if(Test-Path C:\Windows\logs\CBS\){
  120.     Get-ChildItem "C:\Windows\logs\CBS\*.log" -Recurse -Force -ErrorAction SilentlyContinue |
  121.         remove-item -force -recurse -ErrorAction SilentlyContinue -Verbose
  122.     Write-Host "All CBS logs have been removed successfully!                                                      " -NoNewline -ForegroundColor Green
  123.     Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  124.     } else {
  125.         Write-Host "C:\inetpub\logs\LogFiles\ does not exist, there is nothing to cleanup.                         " -NoNewline -ForegroundColor DarkGray
  126.         Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  127.     }
  128.  
  129.     ## Cleans IIS Logs older then $DaysToDelete
  130.     if (Test-Path C:\inetpub\logs\LogFiles\) {
  131.         Get-ChildItem "C:\inetpub\logs\LogFiles\*" -Recurse -Force -ErrorAction SilentlyContinue |
  132.             Where-Object { ($_.CreationTime -lt $(Get-Date).AddDays(-60)) } | Remove-Item -Force -Verbose -Recurse -ErrorAction SilentlyContinue
  133.         Write-Host "All IIS Logfiles over $DaysToDelete days old have been removed Successfully!                  " -NoNewline -ForegroundColor Green
  134.         Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  135.     }
  136.     else {
  137.         Write-Host "C:\Windows\logs\CBS\ does not exist, there is nothing to cleanup.                                 " -NoNewline -ForegroundColor DarkGray
  138.         Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  139.     }
  140.  
  141.     ## Removes C:\Config.Msi
  142.     if (test-path C:\Config.Msi){
  143.         remove-item -Path C:\Config.Msi -force -recurse -Verbose -ErrorAction SilentlyContinue
  144.     } else {
  145.         Write-Host "C:\Config.Msi does not exist, there is nothing to cleanup.                                        " -NoNewline -ForegroundColor DarkGray
  146.         Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  147.     }
  148.  
  149.     ## Removes c:\Intel
  150.     if (test-path c:\Intel){
  151.         remove-item -Path c:\Intel -force -recurse -Verbose -ErrorAction SilentlyContinue
  152.     } else {
  153.         Write-Host "c:\Intel does not exist, there is nothing to cleanup.                                             " -NoNewline -ForegroundColor DarkGray
  154.         Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  155.     }
  156.  
  157.     ## Removes c:\PerfLogs
  158.     if (test-path c:\PerfLogs){
  159.         remove-item -Path c:\PerfLogs -force -recurse -Verbose -ErrorAction SilentlyContinue
  160.     } else {
  161.         Write-Host "c:\PerfLogs does not exist, there is nothing to cleanup.                                          " -NoNewline -ForegroundColor DarkGray
  162.         Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  163.     }
  164.  
  165.     ## Removes $env:windir\memory.dmp
  166.     if (test-path $env:windir\memory.dmp){
  167.         remove-item $env:windir\memory.dmp -force -Verbose -ErrorAction SilentlyContinue
  168.     } else {
  169.         Write-Host "C:\Windows\memory.dmp does not exist, there is nothing to cleanup.                                " -NoNewline -ForegroundColor DarkGray
  170.         Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  171.     }
  172.  
  173.     ## Removes rouge folders
  174.     Write-host "Deleting Rouge folders                                                                            " -NoNewline -ForegroundColor Green
  175.     Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  176.  
  177.     ## Removes Windows Error Reporting files
  178.     if (test-path C:\ProgramData\Microsoft\Windows\WER){
  179.         Get-ChildItem -Path C:\ProgramData\Microsoft\Windows\WER -Recurse | Remove-Item -force -recurse -Verbose -ErrorAction SilentlyContinue
  180.             Write-host "Deleting Windows Error Reporting files                                                            " -NoNewline -ForegroundColor Green
  181.             Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  182.         } else {
  183.             Write-Host "C:\ProgramData\Microsoft\Windows\WER does not exist, there is nothing to cleanup.            " -NoNewline -ForegroundColor DarkGray
  184.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  185.     }
  186.  
  187.     ## Removes System and User Temp Files - lots of access denied will occur.
  188.     ## Cleans up c:\windows\temp
  189.     if (Test-Path $env:windir\Temp\) {
  190.         Remove-Item -Path "$env:windir\Temp\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  191.     } else {
  192.             Write-Host "C:\Windows\Temp does not exist, there is nothing to cleanup.                                 " -NoNewline -ForegroundColor DarkGray
  193.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  194.     }
  195.  
  196.     ## Cleans up minidump
  197.     if (Test-Path $env:windir\minidump\) {
  198.         Remove-Item -Path "$env:windir\minidump\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  199.     } else {
  200.             Write-Host "$env:windir\minidump\ does not exist, there is nothing to cleanup.                           " -NoNewline -ForegroundColor DarkGray
  201.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  202.     }
  203.  
  204.     ## Cleans up prefetch
  205.     if (Test-Path $env:windir\Prefetch\) {
  206.         Remove-Item -Path "$env:windir\Prefetch\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  207.     } else {
  208.             Write-Host "$env:windir\Prefetch\ does not exist, there is nothing to cleanup.                           " -NoNewline -ForegroundColor DarkGray
  209.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  210.     }
  211.  
  212.     ## Cleans up each users temp folder
  213.     if (Test-Path "C:\Users\*\AppData\Local\Temp\") {
  214.         Remove-Item -Path "C:\Users\*\AppData\Local\Temp\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  215.     } else {
  216.             Write-Host "C:\Users\*\AppData\Local\Temp\ does not exist, there is nothing to cleanup.                  " -NoNewline -ForegroundColor DarkGray
  217.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  218.     }
  219.  
  220.     ## Cleans up all users windows error reporting
  221.     if (Test-Path "C:\Users\*\AppData\Local\Microsoft\Windows\WER\") {
  222.         Remove-Item -Path "C:\Users\*\AppData\Local\Microsoft\Windows\WER\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  223.     } else {
  224.             Write-Host "C:\ProgramData\Microsoft\Windows\WER does not exist, there is nothing to cleanup.            " -NoNewline -ForegroundColor DarkGray
  225.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  226.     }
  227.  
  228.     ## Cleans up users temporary internet files
  229.     if (Test-Path "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\") {
  230.         Remove-Item -Path "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  231.     } else {
  232.             Write-Host "C:\Users\*\AppData\Local\Microsoft\Windows\Temporary Internet Files\ does not exist.              " -NoNewline -ForegroundColor DarkGray
  233.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  234.     }
  235.  
  236.     ## Cleans up Internet Explorer cache
  237.     if (Test-Path "C:\Users\*\AppData\Local\Microsoft\Windows\IECompatCache\") {
  238.         Remove-Item -Path "C:\Users\*\AppData\Local\Microsoft\Windows\IECompatCache\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  239.     } else {
  240.             Write-Host "C:\Users\*\AppData\Local\Microsoft\Windows\IECompatCache\ does not exist.                         " -NoNewline -ForegroundColor DarkGray
  241.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  242.     }
  243.  
  244.     ## Cleans up Internet Explorer cache
  245.     if (Test-Path "C:\Users\*\AppData\Local\Microsoft\Windows\IECompatUaCache\") {
  246.         Remove-Item -Path "C:\Users\*\AppData\Local\Microsoft\Windows\IECompatUaCache\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  247.     } else {
  248.             Write-Host "C:\Users\*\AppData\Local\Microsoft\Windows\IECompatUaCache\ does not exist.                       " -NoNewline -ForegroundColor DarkGray
  249.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  250.     }
  251.  
  252.     ## Cleans up Internet Explorer download history
  253.     if (Test-Path "C:\Users\*\AppData\Local\Microsoft\Windows\IEDownloadHistory\") {
  254.         Remove-Item -Path "C:\Users\*\AppData\Local\Microsoft\Windows\IEDownloadHistory\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  255.     } else {
  256.             Write-Host "C:\Users\*\AppData\Local\Microsoft\Windows\IEDownloadHistory\ does not exist.                     " -NoNewline -ForegroundColor DarkGray
  257.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  258.     }
  259.  
  260.     ## Cleans up Internet Cache
  261.     if (Test-Path "C:\Users\*\AppData\Local\Microsoft\Windows\INetCache\") {
  262.         Remove-Item -Path "C:\Users\*\AppData\Local\Microsoft\Windows\INetCache\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  263.     } else {
  264.             Write-Host "C:\Users\*\AppData\Local\Microsoft\Windows\INetCache\ does not exist.                             " -NoNewline -ForegroundColor DarkGray
  265.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  266.     }
  267.  
  268.     ## Cleans up Internet Cookies
  269.     if (Test-Path "C:\Users\*\AppData\Local\Microsoft\Windows\INetCookies\") {
  270.         Remove-Item -Path "C:\Users\*\AppData\Local\Microsoft\Windows\INetCookies\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  271.     } else {
  272.             Write-Host "C:\Users\*\AppData\Local\Microsoft\Windows\INetCookies\ does not exist.                           " -NoNewline -ForegroundColor DarkGray
  273.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  274.     }
  275.  
  276.     ## Cleans up terminal server cache
  277.     if (Test-Path "C:\Users\*\AppData\Local\Microsoft\Terminal Server Client\Cache\") {
  278.         Remove-Item -Path "C:\Users\*\AppData\Local\Microsoft\Terminal Server Client\Cache\*" -Force -Recurse -Verbose -ErrorAction SilentlyContinue
  279.     } else {
  280.             Write-Host "C:\Users\*\AppData\Local\Microsoft\Terminal Server Client\Cache\ does not exist.                  " -NoNewline -ForegroundColor DarkGray
  281.             Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  282.     }
  283.  
  284.     Write-host "Removing System and User Temp Files                                                               " -NoNewline -ForegroundColor Green
  285.     Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  286.  
  287.     ## Removes the hidden recycling bin.
  288.     if (Test-path 'C:\$Recycle.Bin'){
  289.         Remove-Item 'C:\$Recycle.Bin' -Recurse -Force -Verbose -ErrorAction SilentlyContinue
  290.     } else {
  291.         Write-Host "C:\`$Recycle.Bin does not exist, there is nothing to cleanup.                                      " -NoNewline -ForegroundColor DarkGray
  292.         Write-Host "[WARNING]" -ForegroundColor DarkYellow -BackgroundColor Black
  293.     }
  294.  
  295.     ## Turns errors back on
  296.     $ErrorActionPreference = "Continue"
  297.  
  298.     ## Checks the version of PowerShell
  299.     ## If PowerShell version 4 or below is installed the following will process
  300.     if ($PSVersionTable.PSVersion.Major -le 4) {
  301.  
  302.         ## Empties the recycling bin, the desktop recyling bin
  303.         $Recycler = (New-Object -ComObject Shell.Application).NameSpace(0xa)
  304.         $Recycler.items() | ForEach-Object {
  305.             ## If PowerShell version 4 or bewlow is installed the following will process
  306.             Remove-Item -Include $_.path -Force -Recurse -Verbose
  307.             Write-Host "The recycling bin has been cleaned up successfully!                                        " -NoNewline -ForegroundColor Green
  308.             Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  309.         }
  310.     } elseif ($PSVersionTable.PSVersion.Major -ge 5) {
  311.          ## If PowerShell version 5 is running on the machine the following will process
  312.          Clear-RecycleBin -DriveLetter C:\ -Force -Verbose
  313.          Write-Host "The recycling bin has been cleaned up successfully!                                               " -NoNewline -ForegroundColor Green
  314.          Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  315.     }
  316.  
  317.     ## Starts cleanmgr.exe
  318.     Function Start-CleanMGR {
  319.         Try{
  320.             Write-Host "Windows Disk Cleanup is running.                                                                  " -NoNewline -ForegroundColor Green
  321.             Start-Process -FilePath Cleanmgr -ArgumentList '/sagerun:1' -Wait -Verbose
  322.             Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  323.         }
  324.         Catch [System.Exception]{
  325.             Write-host "cleanmgr is not installed! To use this portion of the script you must install the following windows features:" -ForegroundColor Red -NoNewline
  326.             Write-host "[ERROR]" -ForegroundColor Red -BackgroundColor black
  327.         }
  328.     } Start-CleanMGR
  329.  
  330.     ## gathers disk usage after running the cleanup cmdlets.
  331.     $After = Get-WmiObject Win32_LogicalDisk | Where-Object { $_.DriveType -eq "3" } | Select-Object SystemName,
  332.     @{ Name = "Drive" ; Expression = { ( $_.DeviceID ) } },
  333.     @{ Name = "Size (GB)" ; Expression = {"{0:N1}" -f ( $_.Size / 1gb)}},
  334.     @{ Name = "FreeSpace (GB)" ; Expression = {"{0:N1}" -f ( $_.Freespace / 1gb ) } },
  335.     @{ Name = "PercentFree" ; Expression = {"{0:P1}" -f ( $_.FreeSpace / $_.Size ) } } |
  336.         Format-Table -AutoSize | Out-String
  337.  
  338.     ## Restarts wuauserv
  339.     Get-Service -Name wuauserv | Start-Service -ErrorAction SilentlyContinue
  340.  
  341.     ## Stop timer
  342.     $Enders = (Get-Date)
  343.  
  344.     ## Calculate amount of seconds your code takes to complete.
  345.     Write-Verbose "Elapsed Time: $(($Enders - $Starters).totalseconds) seconds
  346.  
  347. "
  348.     ## Sends hostname to the console for ticketing purposes.
  349.     Write-Host (Hostname) -ForegroundColor Green
  350.  
  351.     ## Sends the date and time to the console for ticketing purposes.
  352.     Write-Host (Get-Date | Select-Object -ExpandProperty DateTime) -ForegroundColor Green
  353.  
  354.     ## Sends the disk usage before running the cleanup script to the console for ticketing purposes.
  355.     Write-Verbose "
  356. Before: $Before"
  357.  
  358.     ## Sends the disk usage after running the cleanup script to the console for ticketing purposes.
  359.     Write-Verbose "After: $After"
  360.  
  361.    
  362.  
  363.     ## Completed Successfully!
  364.     Write-Host (Stop-Transcript) -ForegroundColor Green
  365.  
  366.     Write-host "
  367. Script finished                                                                                   " -NoNewline -ForegroundColor Green
  368.     Write-Host "[DONE]" -ForegroundColor Green -BackgroundColor Black
  369.  
  370. }
  371. Start-Cleanup
  372.  
  373.     ##closes the powershell window
  374.  
  375. stop-process -Id $PID
  376.  
  377. [string](0..33|%{[char][int](46+("686552495351636652556262185355647068516270555358646562655775 0645570").substring(($_*2),2))})-replace " "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement