Saturday, October 27, 2018

Automatically Download Outlook Attachments to Folder With VBA And Rule


Automatically Download Outlook Attachments To Folder With VBA And Rule
This method will introduce a VBA script, and run this scrip with a rule to automatically download and save Outlook attachments to a certain folder. Please do as follows:
1. Press Alt + F11 keys to open the Microsoft Visual Basic for Applications window.
2. Click Insert > Module, and then paste below VBA script into the new opening Module window.
VBA: Auto Save Outlook Attachments into a certain folder
1
2
3
4
5
6
7
8
Public Sub SaveAttachmentsToDisk(MItem As Outlook.MailItem)
Dim oAttachment As Outlook.Attachment
Dim sSaveFolder As String
sSaveFolder = "C:\Users\DT168\Documents\outlook-attachments\"
For Each oAttachment In MItem.Attachments
oAttachment.SaveAsFile sSaveFolder & oAttachment.DisplayName
Next
End Sub
Note: Please find out sSaveFolder = "C:\Users\DT168\Documents\outlook-attachments\", and replace the destination folder’s path as you need.
3. Save the VBA Script and close the Microsoft Visual Basic for Applications window.
4. Go to the Mail view, and click Home > Rules Manage Rules & Alerts. See screenshot:

5. In the opening Rules and Alerts dialog box, please click the New Rule button on the E-mail Rules tab. See screenshot:


6. Now in the Rules Wizard dialog box, please click to select the Apply rule on messages I receive option, and click the Next button.

7. In the Rules Wizard (which condition(s) do you want to check?) dialog box, please uncheck any option, and click the Next button. And then click the Yes button in the popping up Microsoft Outlook dialog box. See screenshot:






8. Now in the Rules Wizard (what do you want to do with the message?) dialog box, please: (1) Check the run a script option; (2) Click the text of a script to open the Select Script dialog box, select the script we added in Step 2 and click the OK button; (3) Click the Next button.



9. In the Rules Wizard (Are there any exceptions?) dialog box, please click the Next button directly.
10. Now in the last Rules Wizard dialog box, please name the rule in the Step 1 box, check options as you need in the Step 2 section, and click the Finish button.


11. Close the Rules and Alerts dialog box.
And now all attachments are downloaded from your email account and saved into the specified destination folder. And all attachments of incoming emails will be automatically downloaded and saved into the specified folder too.


Wednesday, August 29, 2018

DNS IP add and delete through command for windows


Set primary DNS IP

netsh interface ip add dns name="167.NIC" 148.173.250.28 index=1



Set secondary DNS IP

netsh interface ip add dns name="167.NIC" 148.173.250.141 index=2

Delete DNS IP


netsh interface ipv4 delete dnsserver "167.NIC" 148.173.250.27

Wednesday, April 11, 2018

Unable to add performance monitor counters in Windows 2008 Server R2

Unable to add performance monitor counters in Windows 2008 Server R2

Filed under: Windows 2008 Servers

Tags: lodctr /r, performace counter

We were facing this issue in one of the Windows 2008 R2 x64 server and this server


The following error occurred while loading performance monitor

Unable to add these counters:

\Memory\Available MBytes

\Memory\% Committed Bytes In Use

\Memory\Cache Faults/sec

\Memory\Cache Faults/sec

\PhysicalDisk(*)\%Idle Time

\PhysicalDisk(*)\Avg. Disk Queue Length

\Network Interface(*)\Bytes Total/sec”


Cause

Te issue was perfmon Counters were corrupted, and have to rebuild these with LODCTR from command prompt. (Run As Administrator)

Resolution

Open Command Prompt , type lodctr /r and press ENTER. This will repair the pointers

C:\Windows\system32>lodctr/r

You have to check is there any providers are disabled. You can check the status with lodctr /q.

[Windows SharePoint Services Performance Monitoring] Performance Counters (Enabled)
DLL Name: C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\BIN\onetnative.dllOpen Procedure: OpenPerformanceData
Collect Procedure: CollectPerformanceData
Close Procedure: ClosePerformanceData
First Counter ID: 0x00002A0E (10766)
Last Counter ID: 0x00002A12 (10770)
First Help ID: 0x00002A0F (10767)
Last Help ID: 0x00002A13 (10771)

If it says (Disabled) next to a provider, you can enable it with lodctr/e:<provider name>.

Then try to open perfmon  from run it will work and there is no error.

Wednesday, March 28, 2018

Ping with time stamp

ping -t google.com |cmd /q /v /c "(pause&pause)>nul & for /l %a in () do (set /p "data=" && echo(!date! !time! !data!)&ping -n 2 google.com>nul" >C:\pingtest.txt

Friday, November 18, 2016

How to enable PAE On Windows Server 2008 Standard 32bit increasing RAM from 4GB to above

How to enable PAE on Windows Server 2008 Standard 32-Bit
1.  Log in to the server
2.  Once logged in, click on START, Right click on command prompt icon and choose Run as administrator

3.  Once command prompt opens, type bcdedit /set pae forceenable then press enter.  Command should successfully complete without any errors.
6.  Restart server.
7.  Once server restarts, open task manager, click on Performance tab and check Physical Memory.
8.  Done!

Monday, November 14, 2016

How to enable container option using ADSIT Edit tool


 How to enable container option using ADSIT Edit tool
You need to create Active Directory Container. In this case the most people probably thinking is that they have to create an OU (Organizational Unit), but that is not the case.
There are a few differences between an Active Directory Container and an Active Directory OU. The main difference is that Group Policy Objects (GPO) cannot be applied to a container.
The Active Directory Users and Computers program will not give the option the create Container objects by default (right click, new). But with the following procedure, you can enable this. (You have to be member of the “Schema Admins” security group)
Open “Adsiedit.msc”, richt click “ADSI Edit” and click on “Connect to…”


 Select “Schema” by “Select a well known Naming Context” and press the “OK” button
 
In the left plane select “Schema,CN=Configuration,DC=domain,DC=lan” and look in the right plane for “CN=Container”. Open its properties.

 Change the value of “defaultHidingValue” to “FALSE” and press the “OK” button.


 Open the Active Directory Users and Computers program (check if Advanced Features are visible), right click on the domain name or any Container/OU and select the “New” option. The Container option is now also listed in the list of objects.


 It’s done.

Monday, October 31, 2016

Licensing mode for the Remote Desktop Session Host is not configured

Licensing mode for the Remote Desktop Session Host is not configured

How to fix RDS 2012r2 error: “Licensing mode for the Remote Desktop Session Host is not configured.”

Remote Desktop Session Host (RD Session Host) enables a server to host RemoteApp programs or session-based desktops. Users can connect to RD Session Host servers in a session collection to run programs, save files, and use resources on those servers.
We recently solved a known issue related to the licenses required to connect to a Remote Desktop Session Host server or a virtual desktop. The error description reads: “Licensing mode for the Remote Desktop Session Host is not configured.”
Licensing mode for RDS Host server is not configured resized 600
We developed a fix for the licensing issue with RDS on server 2012r2. We found some solutions for this known bug but none that actually worked. Incidentally, deleting the GracePeriod key like many forums said didn’t fix the problem.

To fix the problem, run the following commands in powershell to set the licensing server properly on the rd session host using the WMI CIM provider:
$obj = gwmi -namespace "Root/CIMV2/TerminalServices" Win32_TerminalServiceSetting
$obj. SetSpecifiedLicenseServerList("licserver.domain.local")

Then, go into the registry and manually set the licensing mode:

HKLM\SYSTEM\CurrentControlSet\Control\Terminal Server\RCM\Licensing Core\LicensingMode

You need to change the DWORD to 2 for Per Device or 4 for Per User.
Licensing Mode in Registry Editor
Next, reboot the system. The changes made previously will report everything properly and the RDS host will now recognize the licensing configuration.