SpamHaus SBL Checker PHP Script – Takes domain and returns number of assigned SBLs and total blocked IPs.

This is a very nice script written by D. Strout over at VPSBoard.com here. Be sure to leave him some feedback and comments about it. Let us know how you have used it or even modified it for your needs.

Share on Tumblr

CPANEL/WHM: FAILED: cpsrvd on web server

We had a client with OpenVPN setup on a CPanel server and they kept getting these alerts. We decided to do some digging.

The IPTables that they were running for some reason created a route issue.

iptables -A FORWARD -m state --state RELATED,ESTABLISHED -j ACCEPT
 iptables -A FORWARD -s 10.8.0.0/24 -j ACCEPT
 iptables -A FORWARD -j REJECT
 iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o eth0 -j MASQUERADE
 iptables -t nat -A POSTROUTING -j SNAT --to-source SERVER-IP

Here’s the failure in /var/log/chksrvd.log:

Share on Tumblr

TUN/ TAP script for OpenVZ SolusVM

echo "Enter the container ID to activate TUN/TAP on:"
read CTID
vzctl set $CTID --devnodes net/tun:rw --save
vzctl set $CTID --devices c:10:200:rw --save
vzctl set $CTID --capability net_admin:on --save
vzctl exec $CTID mkdir -p /dev/net
vzctl exec $CTID mknod /dev/net/tun c 10 200
vzctl exec $CTID chmod 600 /dev/net/tun
vzctl restart $CTID
Share on Tumblr

Using Powershell and Quest ActiveRoles Management to get User Information from Active Directory

From time to time, either for troubleshooting or information purposes, there exists a need to get certain user information out of Active Directory. Though Microsoft has a bunch of great commands that query AD, I had run into a third-party software that met my need of getting information quickly. Quest  has some great free Powershell scripting tools that help users get certain information out of Active Directory.

At this time, I needed to pull a summary of certain user’s accounts for auditing purposes and decided to script something together that would at a glance display pertinent information.

Share on Tumblr

Remove Windows 8 “Metro” Apps

To remove an application with PowerShell you need to do two actions:

  1. Remove the provisioned package
  2. Remove the “installed” package from the user account.

To remove the provisioned package you use the command Remove-AppxProvisionedPackage (Microsoft) and to remove the installed package you use the command Remove-AppxPackage (Microsoft.

According to Microsoft, the Remove-AppxProvisionedPackage cmdlet removes app packages (.appx) from a Windows image. App packages will not be installed when new user accounts are created. Packages will not be removed from existing user accounts. To remove app packages (.appx) that are not provisioned or to remove a package for a particular user only, use Remove-AppxPackage instead. (link)

Share on Tumblr

Powershell Script – Remove ALL Windows 8.1 Apps and App Store to clean up

Tired of all those annoying Windows Apps that cause security issues and other problems and annoyances?

This script will nicely remove them all for you automatically.

foreach ($ID in $IDs)
{
#check id is in the range
if ($ID -ge 1 -and $ID -le $apps.count)
{
$ID--
#Remove each app
$AppName=$apps[$ID].name
if($PSCmdlet.ShouldProcess("$AppName"))
{
Remove-AppxPackage -Package $apps[$ID] -ErrorAction SilentlyContinue
if (-not(Get-AppxPackage -Name $AppName))
{
Write-host "$AppName has been removed successfully"
}
else
{
Write-Warning "Remove '$AppName' failed! This app is part of Windows and cannot be uninstalled on a per-user basis."
}
}
}
else
{
$errorMsg = $Messages.WrongID
$errorMsg = $errorMsg -replace "Placeholder01",$ID
$customError = PSCustomErrorRecord `
-ExceptionString $errorMsg `
-ErrorCategory NotSpecified -ErrorID 1 -TargetObject $pscmdlet
$pscmdlet.WriteError($customError)
}
}

Share on Tumblr

“The sign-in method you’re trying to use isn’t allowed” – Windows Server 2012

The following steps will allow you have users login correctly. You may wish to at the very least add the group “Domain Users”.

Share on Tumblr

Windows PowerShell Script RPC – Enable Remote Management – The remote Procedure call was cancelled. Error code 8007071a

By default Windows will block remote management requests which are required when running Active Directory and Group Policy Objects. The following is a Powershell script that can be ran locally on machines to enable remote management.

netsh advfirewall firewall add rule name=SQL-SSMS dir=in action=allow enable=yes profile=any
netsh advfirewall firewall add rule name=SQL-SSMS dir=out action=allow program=any enable=yes profile=any
netsh advfirewall firewall set rule group="Remote Administration" new enable=yes
netsh advfirewall firewall set rule group="File and Printer Sharing" new enable=yes
netsh advfirewall firewall set rule group="Remote Service Management" new enable=yes
netsh advfirewall firewall set rule group="Performance Logs and Alerts" new enable=yes
Netsh advfirewall firewall set rule group="Remote Event Log Management" new enable=yes
Netsh advfirewall firewall set rule group="Remote Scheduled Tasks Management" new enable=yes
netsh advfirewall firewall set rule group="Remote Volume Management" new enable=yes
netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes
netsh advfirewall firewall set rule group="Windows Firewall Remote Management" new enable =yes
netsh advfirewall firewall set rule group="windows management instrumentation (wmi)" new enable =yes

Share on Tumblr