Search Computer Help Please

Tuesday, October 10, 2017

Windows Task Scheduler - Error 0x1 and Running SQLCMD , BATCH or VBS Script


Error/Issue: One day you wake up the sun is out you feel great but low and behold your windows scheduled tasks are no longer working. You will either get

(0x1) - For the Last Run Time

or they will run for eternity and not actually do anything.

Have had this error on windows server 2012 but not 2008 so I'm not sure what the difference is , anyway onto the FIX.

The FIX:

You will have to alter the jobs slightly to make them run again under your scheduled tasks.

example SQLCMD and VBS Script

SQLCMD


Task: To Backup all SQL Databases and dump .bak files into directory on local server

Settings:

- Run whether user is logged on or not
- Run with highest privileges

Actions

- Start a program
- Program/Script: "C:\Program Files\Microsoft SQL Server\100\Tools\Binn\SQLCMD.EXE"  (or your location)
- Add arguments (optional):

-S SQLBOX\SQL2016 -d master -E -Q "EXECUTE dbo.DatabaseBackup @Databases = 'USER_DATABASES', @Directory = 'E:\BackupLocation', @BackupType = 'FULL'" -b

If your looking for the database backup procedure you can grab it at https://ola.hallengren.com



VBS Example

Task: To delete any files older than 60 days in a directory, handy for cleaning up old backups

Settings:

- Run whether user is logged on or not
- Run with highest privileges

Start a program
- Program/Script: C:\Windows\System32\cscript.exe
- Add arguments (optional): "E:\Folder\CleanOld Files.VBS"      (quotation marks needed as there are spaces)
- Start in (optional) : C:\Windows\System32\


that is it you are now up and running



Windows Server 2016 - Remote Desktop Gateway - Only One UDP Session FIX


Issue: Even when enabling UDP under transport setting in the remote desktop manager , My remote desktop gateway connections refused to use more than 1 UDP session at a time. Therefore reducing the connection speed and impacting user experience.

First Step: right click server name in remote desktop gateway manager and ensure UDP transport is enabled.

Note: Ensure you are forwarding UDP traffic from port 3391 (or what you set it to ) through your firewall from outside to inside.


The FIX:

The fix is actually very simple , for some reason even when you haven't set Group Policies relating to Remote desktop services and connections that assumes you want it off by default , which is annoying to say the least.

1. Open GPEDIT.MSC

2.  Go to Computer Configuration -> Administrative Templates -> Windows Components, Remote Desktop Services -> Remote Desktop Session Host -> Connections 

3. Select -> Select RDP Transport Protocols

4. Enable and select both UDP and TCP

for some reason when its not enabled it only gives you the one UDP session , it seems like a 2016 server glitch to me

oooooh happppy days..



Computer Help Please