Delete the cert
certutil.exe -user -delstore my TheCertName.pfx
Delete the associated SSL and URL
netsh http delete sslcert ipport=0.0.0.0:8443
netsh http delete urlacl url=”https://127.0.0.1:8443/”
Reference: http://ss64.com/nt/certutil.html
Lab Core | The Lab of MrNetTek
A blog about IT, technical solutions, and code.
Be careful with this!
You can delete all files meeting a certain criteria or pattern. For example, if you wanted to delete all files on your computer starting with a tilde:
del /s /q “~*.*”
You could have as easily done:
del /s /q “*.tmp”
del /s /q “*.cmd”
del /s /q “5*.*”
del /s /q “my*.*”
del /s /q “*.docx*”
del /s /q — the /s is cycle through subdirectories and the /q is quiet mode
Moving My Documents to a subfolder
The For command will cycle the the My Documents folder performing the robocopy command on each item. FOR conditionally performs any command or a specified sequence of commands multiple times.
for /d %%Y in (Sta??) do (for /f “usebackq tokens=*” %%U in (‘dir /b /ad “%%~Y\*”‘) do (robocopy.exe “%%~Y\%%~U” “%%~Y\%%~U\Documents” /e /move /xd “Documents”))
Reference: http://ss64.com/nt/for.html http://ss64.com/nt/robocopy.html
$DaysInactive = (Get-Date).AddDays(-90)
$Leavers = Get-ADUser -Filter { Enabled -eq $false -and LastLogonTimeStamp -ge $DaysInactive } -SearchBase “OU=Employees,DC=DomainName,DC=com” -Properties HomeDirectory
ForEach ($User in $Leavers) {
$ArchivePath = [io.path]::Combine(“Z:\EmployeesArchived”,$User.SamAccountName)
If (Test-Path $User.HomeDirectory) {
Move-Item –Path $User.HomeDirectory -Destination $ArchivePath -Force
}
}
$Leavers = Get-ADUser -Filter { Enabled -eq $false } -SearchBase “OU=Employees,DC=DomainName,DC=com” -Properties HomeDirectory
ForEach ($User in $Leavers) {
$ArchivePath = [io.path]::Combine(“Z:\EmployeesArchived”, $User.SamAccountName)
If (Test-Path $User.HomeDirectory) {
Move-Item –Path $User.HomeDirectory -Destination $ArchivePath -Force
}
}
Part of the sequence script
c:\windows\system32\msiexec.exe /i “%CD%\AppleApplicationSupport.msi” /qn /norestart
c:\windows\system32\msiexec.exe /i “%CD%\AppleApplicationSupport64.msi” /qn /norestart
c:\windows\system32\msiexec.exe /i “%CD%\AppleMobileDeviceSupport64.msi” /qn /norestart
c:\windows\system32\msiexec.exe /i “%CD%\Bonjour64.msi” /qn /norestart
c:\windows\system32\msiexec.exe /i “%CD%\AppleSoftwareUpdate.msi” /qn /norestart
c:\windows\system32\msiexec.exe /i “%CD%\iTunes6464.msi” /qn /norestart IAcceptLicense=Yes ALLUSERS=1 DESKTOP_SHORTCUTS=1 INSTALL_ASUW=0 NO_ASUW=1
“%CurDir%\copytoallprofiles_7.vbs”
The copytoallprofiles_7.vbs script – cycles through profiles to copy custom settings
If the iTunesPrefs.xml isn’t working for you, take a look at com.apple.iTunes.plist. Apple loves to sneak in new ways of storing configs.
on error resume next Set objShell = CreateObject("Wscript.Shell") Set objFSO = CreateObject("Scripting.FileSystemObject") Const HKEY_LOCAL_MACHINE = &H80000002 Const OverwriteExisting = TRUE Source1 = "C:\Program Files (x86)\LANDesk\LDClient\sdmcache\apps\Apple\iTunes\12.2.2.25\<strong>iTunesPrefs.xml</strong>" 'SETS CURRENT DIRECTORY TO VARIABLE strCurrentDirectory = objShell.CurrentDirectory on error resume next 'LSource1 = strCurrentDirectory & "\iTunesPrefs.xml" 'LSource2 = strCurrentDirectory & "\First Run" 'Target is dynamic is assigned below strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set objRegistry=GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv") strKeyPath = "SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion\ProfileList" objRegistry.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubkeys For Each objSubkey In arrSubkeys on error resume next strValueName = "ProfileImagePath" strSubPath = strKeyPath & "\" & objSubkey objRegistry.GetExpandedStringValue HKEY_LOCAL_MACHINE,strSubPath,strValueName,strValue Const POPUP_TITLE = "User To SID Conversion" Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set objAccount = objWMIService.Get("Win32_SID.SID='" & objSubkey & "'") strUser = objAccount.AccountName 'strDomain = objAccount.ReferencedDomainName'returns referenced domain 'DISPLAY PROFILE NAME & SID objSubkey = trim(objSubkey)'trims whitespace strUser = trim(strUser)'trims whitespace 'msgbox "objSubkey: " & objSubkey'returns SID 'msgbox strUser'returns username 'LOGIC TO DETERMINE IF REGISTRY ACCOUNT IS TO BE LOADED if strUser = "SYSTEM" then strUser="" if strUser = "LOCAL SERVICE" then strUser="" if strUser = "NETWORK SERVICE" then strUser="" if strUser = "ADMINISTRATOR" then strUser="" if strUser <> "" then on error resume next objShell.Run "%comspec% /c md " & chr(34) & "C:\users\" & strUser & "\AppData\Roaming\Apple Computer\iTunes" & chr(34),0,false Wscript.Sleep 1000 'path for local users Target1 = "C:\users\" & strUser & "\AppData\Roaming\Apple Computer\iTunes\" 'path for redirected users objFSO.CopyFile Source1, Target1, OverwriteExisting 'FAILSAFE on error resume next strMainSource = "C:\Program Files (x86)\LANDesk\LDClient\sdmcache\apps\Apple\iTunes\12.2.2.25" strMainTarget1 = strValue & "\AppData\Roaming\Apple Computer\iTunes" Wscript.Sleep 1000 'vbcsript copy objFSO.CopyFile "C:\Program Files (x86)\LANDesk\LDClient\sdmcache\apps\Apple\iTunes\12.2.2.25\<strong>iTunesPrefs.xml</strong>", strValue & "\AppData\Roaming\Apple Computer\iTunes\", OverwriteExisting Wscript.Sleep 1000 'shell copy 'for local users objShell.Run "%comspec% /c copy /y " & chr(34) & strMainSource & "\iTunesPrefs.xml" & chr(34) & " " & chr(34) & strMainTarget1 & "\iTunesPrefs.xml" & chr(34),0,true objShell.Run "%comspec% /c copy /y " & chr(34) & strCurrentDirectory & "\iTunesPrefs.xml" & chr(34) & " " & chr(34) & strMainTarget1 & "\iTunesPrefs.xml" & chr(34),0,true 'added for redirected users 'objShell.Run "%comspec% /c copy /y " & chr(34) & strCurrentDirectory & "\iTunesPrefs.xml" & chr(34) & " " & chr(34) & Target2 & "\iTunesPrefs.xml" & chr(34),0,true Wscript.Sleep 1000 end if Next
OfficeMix.Setup.exe firstrun=0 /quiet /norestart
reg.exe DELETE HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSLicensing /f
start “” C:\Windows\System32\mstsc.exe
Reference: https://technet.microsoft.com/en-us/library/cc758805%28v=ws.10%29.aspx?f=255&MSPPError=-2147217396
rem The Microsoft Scrubber
microsoftscrubber.vbs Groove
rem Delete the start menu icon
del /q “C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office 2013\OneDrive for Business 2013.lnk”
rem Delete the registry key
reg DELETE “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\GrooveRetail – en-us” /f