Thursday, May 28, 2020

DNS Scavening not working

IF DNS Scavenging is enabled on the server , configured  the Scavenging Cycle and Aging (No Refresh and Refresh interval)  but old records are not deleting yet,

type in cmd dnscmd /zoneinfo test.com


you will see ....Ptr          = 000000000031D480               MaxCount     = 1                AddrCount    = 1                                Server[0] => af=2, salen=16, [sub=0, flag=00000000] p=13568, addr=192.168.1.1


Here you notice the IP address 192.168.1.1.


This is the IP address of the server which has the permission to scavenge the zone (Most likely this could be a server which is no longer existing)
If this is not the IP address of the server which on which you have configured Scavenging then we need to change that.


To change the Scavenging server for a zone, run the command:


dnscmd /zoneresetscavengeservers test.com <Ip of the current DNS Server>


where <IP of the current DNS Server> is the IP address of the DNS Server where Scavenging is configured.


Source

Tuesday, March 10, 2020

Generate random password in Powershell

$characters = 'abcdefghkmnprstuvwxyzABCDEFGHKLMNPRSTUVWXYZ'
$nonchar = '123456789!$%&?+#'
$length = 15  #The total length will be 15, the last two characters are nonchar.

# select random characters
$random = 1..$length | ForEach-Object { Get-Random -Maximum $characters.length }
$random2 = 1..2 | ForEach-Object { Get-Random -Maximum $nonchar.length }

$private:ofs= ""
$password = [String]$characters[$random] + [String]$nonchar[$random2]
return $password

Wednesday, January 22, 2020

Get list of un protected OU's

To get locating OUs that isn't protected from accidental deletion in AD

Get-ADOrganizationalUnit -filter * -Properties ProtectedFromAccidentalDeletion | where {$_.ProtectedFromAccidentalDeletion -eq $false}

Tuesday, January 14, 2020

Active Directory – SID Filtering

Run Powershell as Enterprise Administrator:

to Deactivate Sid Filter:

Netdom trust <TrustingDomainName> /domain:<TrustedDomainName> /quarantine:No

to Activate:

Netdom trust <TrustingDomainName> /domain:<TrustedDomainName> /enablesidhistory:Yes

Source

Sunday, September 8, 2019

Program always run as Administrator

create a new shortcut, and paste

runas /user:ComputerName\Administrator /savecred “C:\Path\To\Program.exe"

Hide Unwanted Fields On Calendar Form

<script src="/SiteAssets/Scripts/jquery-1.8.0.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready( function() {
$("TABLE.ms-formtable>TBODY>TR:eq(1)").css('display', 'none');
$("TABLE.ms-formtable>TBODY>TR:eq(5)").css('display', 'none');
$("TABLE.ms-formtable>TBODY>TR:eq(6)").css('display', 'none');
})</script>

Sharepoint hide left menu

<style type="text/css">
 #sideNavBox {DISPLAY: none}
 #contentBox {MARGIN-LEFT: 5px}
</style>