Batch Script – Sending Items to the Recycle Bin Without Calling Any Third-Party Applications

While writing another larger script, I wanted the ability to send folders or files to the Recycle Bin, which I found out you can’t do natively via the command line without using some third-party apps or PowerShell.

I also found that when looping through a list of files in a batch script, it makes it really difficult to delete folders versus files because you have to either use the “del” command for files or the “rmdir” command for folders. With no simple way to differentiate between the two without a bunch of extra code, I kept looking for an alternative solution.
Continue reading “Batch Script – Sending Items to the Recycle Bin Without Calling Any Third-Party Applications”

Batch Script – Zip/Compress Files Without Calling Any Third-Party Applications

While writing another batch script the last several days, I found out that you cannot zip or compress files or folders natively from the command line without having additional third-party software or PowerShell. After a while of scouring the forums, I came up with this pure batch solution that uses VB script.

Basically, from this chunk of code in a single batch file, we can both generate the VB script, zip up whatever files we want, and then just delete the VB script when we’re done. Within the batch file, we can just call on the VB script using “CScript” and it works pretty much like any other function in any other programming language.
Continue reading “Batch Script – Zip/Compress Files Without Calling Any Third-Party Applications”

Batch Script – Get User’s SID One-Liner

While researching a way to try and send files to a user’s Recycle Bin from a batch script, I came across this one liner either at StackExchange or SuperUser forums somewhere. FYI, there is no way natively to send something to the trash without using a VB script or some third party utility. Yes you can physically move the files into the C:\$Recycle.Bin\<UsersSID> folder, but the files will not show up in Explorer and won’t be removed when you empty the trash that way.
Continue reading “Batch Script – Get User’s SID One-Liner”

Server 2012 – Remove Pinned Items on the Taskbar via Group Policy

I have researched for hours and hours and have looked into numerous different solutions on how to remove pinned items from the taskbar in Server 2012 and have not really found an elegant solution to the problem. Microsoft intentionally made it an extremely ridiculous and convoluted process to be able to add and remove pinned items from the taskbar. I guess it was meant to help prevent it from getting all fuckered up but for christ’s sake, I shouldn’t have to jump through effing hoops just to do such a seemingly rudimentary task.

Part of my particular issue lies in the fact that I’m setting up a completely locked down 2012 RDS environment where the users don’t even have access to the command prompt, powershell, or the ability to run VB scripts. This alone rules out almost every solution out there that I’ve found.

I have even gotten to the point of where I tried using Group Policy Preferences to create a HKCU RunOnce key to run a batch file to delete the necessary files, add the proper registry keys, kill the explorer.exe process, but then I can’t start explorer again without using cmd.exe and I don’t want the user to have to log off and back on again and we can just have a missing shortcut sitting in the freaking taskbar, it confuses people. WTF!!!
Continue reading “Server 2012 – Remove Pinned Items on the Taskbar via Group Policy”

Classic Shell – Remove First Run Wizard with Group Policy

Classic Shell is a necessary evil for any normal Windows user who wants to be able remain productive with introduction of the Start Screen in Server 2012 and Windows 8. As a network administrator, I highly recommend Classic Shell because it even has it’s own Group Policy templates that you can add in with the PolicyDefinitions inside your domain’s SYSVOL folder so you can at least somewhat try to put the Start Menu back to the way it once was. The Start Screen is a technical support person’s worst nightmare for novice users who don’t deal well with change (and trust me they don’t).

If you’re trying to customize a Remote Desktop Server environment, one somewhat annoying thing you will run into is trying to get rid of the first run wizard for Classic Shell. Obviously, the first run wizard is handy for anybody who wants to customize the look and feel of their Start Menu, but more than likely in a Remote Desktop environment, you’re going to want all this predefined with no user interaction so the chances of them screwing things up is slim to none.
Continue reading “Classic Shell – Remove First Run Wizard with Group Policy”

Windows Terminal Server – Three Ways to Disable AVG Tray Icon via Group Policy

I scoured the internet forever and a day to find a way to disable the AVG tray icon in a Windows Terminal Server environment because as with most people, even though to make any major changes in the AVG settings it does require an admin password, I didn’t want my users to be able to toy around in there even, let alone run a bunch of malicious scans and slow the server down for everybody or gain access to view our AVG Business license key. I even contacted AVG technical support and they didn’t have a solution to my problem and I find it extremely hard to believe that I am the only person out there in the world facing this issue.

Well, today I finally figured out a way to disable the AVG tray icon via Group Policy using Software Restriction Policies. By creating a rule to prevent the running of the “avgui.exe” process, you can essentially disable the tray icon. As long as you have your group policies structured so that your users OU get a different group policy than say the admins OU, then the admins can still get into AVG, run any scans, or change any settings inside AVG. I guess I should mention that you could use this for any OU for that matter that you didn’t want to have access to the AVG UI, it’s not just limited to Remote Desktop Servers. Pretty sweet!
Continue reading “Windows Terminal Server – Three Ways to Disable AVG Tray Icon via Group Policy”

Exchange Server 2010 – Purge the Deleted Items (RecoverableItems) Folder

Being the devoted Email Administrator that you are, you notice that the space for storing mailboxes on your Exchange Server is getting dangerously low, so you decide to take action. Logically, your first thought would be to have all your end users go through all the folders in their mailbox and get rid of any junk they don’t need and then empty their “Deleted Items” folder to regain the space back. After all, in most cases there really is no reason for users to keep every single email they’ve ever sent and received since the beginning of time (which a lot of them tend to do and I’ll never understand why).

Unfortunately, as you’ve probably already noticed, that is not the case. Simply having a user empty their “Deleted Items” folder has no effect on the database size whatsoever. This is partially due to the nifty feature that allows users to be able to recover deleted messages after they’ve already emptied their trash. By default, Exchange keeps deleted items for 14 days until they are purged, so now it is necessary to manually force the deletion of these items.
Continue reading “Exchange Server 2010 – Purge the Deleted Items (RecoverableItems) Folder”

Windows 8.1 – Disable IPv6 Components

While trying to troubleshoot some issues with a user’s flaky VPN connection (they could get connected but couldn’t ping anything on the company network), my first guesses were that it was either a routing issue and that IPv6 might be the culprit or that it could be an MTU issue. In searching for the answers on how to disable IPv6, I had stumbled across a blog article that, while seemingly helpful at the time, had some misleading information on it that caused some rather undesirable results. It gave me an incorrect registry value setting of “0xffffffff” that actually caused Windows to take an extra five seconds to boot.
Continue reading “Windows 8.1 – Disable IPv6 Components”