Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Thursday, November 15, 2018

How to delete an application in sccm

From: https://prajwaldesai.com/how-to-delete-an-application-in-sccm-2012/
How to delete an application in sccm 2012. The question is why do you want to delete the application that’s deployed to collections. The reason for deletion of application may be the users won’t require it anymore or another software might be replaced with it which has good features than the existing ones or it any be any other reason.. Well, if you try to right click the application and click delete, the application will not get deleted in SCCM 2012. There is a small procedure that you need to follow in order to delete the application. Lets take a look at it.

How To Delete An Application In SCCM 2012

Launch the ConfigMgr Console, Click on Software LibraryApplication ManagementApplications. In the previous post we had deployed Office 2010 using sccm to a collection. In this post we will be deleting this application from our sccm server.
How To Delete An Application In SCCM 2012 Snap 1
When we right click the application and select Delete, we get a warning message box. It clearly shows that the number of active deployments is 1 which means the application is deployed once. Click OK.
How To Delete An Application In SCCM 2012 Snap 2
Before we delete the application its recommended to retire that application. To do so right click the application and click Retire.
How To Delete An Application In SCCM 2012 Snap 3
Next we click on Deployments and we see that the application is deployed to a collection named All Windows 7 Systems. Right click the Collection and click Delete.
How To Delete An Application In SCCM 2012 Snap 4
Right click the Application and click Revision History.
How To Delete An Application In SCCM 2012 Snap 5
On the Application Revision History window, start deleting the revisions from the bottom.
How To Delete An Application In SCCM 2012 Snap 6
Delete all the revisions one by one.
How To Delete An Application In SCCM 2012 Snap 7
Once you have deleted all the revisions, right the application and delete it. You get a warning box, click Yes to delete the app permanently.
How To Delete An Application In SCCM 2012 Snap 8

Monday, October 4, 2010

Delete Files Older Than X Days Recursely

  1. Save as vbs - deletefiles.vbs
  2. to use pass in number folder and number of days
For example deletefiles.vbs c:\temp 60

' Pass the arguments
Set objFSO = Wscript.CreateObject("Scripting.FileSystemObject")
path = Wscript.Arguments.Item(0)

' folder to start search in... You can just use static
'path = "C:\Temp\test"


' delete files older than 2 days...
mDays = Wscript.Arguments.Item(1)

killdate = date() - mDays

arFiles = Array()
set fso = createobject("scripting.filesystemobject")


' Don't do the delete while you still are looping through a
' file collection returned from the File System Object (FSO).
' The collection may get mixed up.
' Create an array of the file objects to avoid this.
'
SelectFiles path, killdate, arFiles, true


nDeleted = 0
for n = 0 to ubound(arFiles)
  '=================================================
  ' Files deleted via FSO methods do *NOT* go to the recycle bin!!!
  '=================================================
  on error resume next 'in case of 'in use' files...
  arFiles(n).delete true
  if err.number <> 0 then
    wscript.echo "Unable to delete: " & arFiles(n).path
  else
    nDeleted = nDeleted + 1
    'start 20100630 schneiderbi
    wscript.echo arFiles(n).path
    'end 20100630 schneiderbi
  end if
  on error goto 0
next


'msgbox nDeleted & " of " & ubound(arFiles)+1 _
'  & " eligible files were deleted"


sub SelectFiles(sPath,vKillDate,arFilesToKill,bIncludeSubFolders)
  on error resume next
  'select files to delete and add to array...
  '
  set folder = fso.getfolder(sPath)
  set files = folder.files


  for each file in files
    ' uses error trapping around access to the
    ' Date property just to be safe
    '
    dtlastmodified = null
    on error resume Next
    dtlastmodified = file.datelastmodified
    on error goto 0
    if not isnull(dtlastmodified) Then
      if dtlastmodified < vKillDate then
        count = ubound(arFilesToKill) + 1
        redim preserve arFilesToKill(count)
        set arFilesToKill(count) = file
      end if
    end if
  next


  if bIncludeSubFolders then
    for each fldr in folder.subfolders
      SelectFiles fldr.path,vKillDate,arFilesToKill,true
    next
  end if
end sub