Friday, January 29, 2016

Exchange PowerShell: Find users hidden from the Global Address List

Get-Mailbox | Where {$_.HiddenFromAddressListsEnabled -eq $True} | Select Name, HiddenFromAddressListsEnabled | export-csv c:\hiddenfromGAL.csv

Source

Thursday, January 28, 2016

Low Disk Space Email Notification

# Set Global Parameters
$emailTO = "SomeOne@SomeDomain.com"
$emailFrom = "SomeOne@SomeDomain.com"
$smtpServer = "SMTPserverInfo"

$computers = ("server1","server2","server3","server4")
$i = 0

# Get Drive Data
$report = @(
foreach($computer in $computers)
{
$drives = Get-WmiObject -ComputerName $computer Win32_LogicalDisk | Where-Object {$_.DriveType -eq 3}
     foreach($drive in $drives)
     {
          # Calculate Free Space
          $obj = new-object psobject -Property @{
               ComputerName = $computer
               Drive = $drive.DeviceID
               Size = $drive.size / 1GB
               Free = $drive.freespace / 1GB
               PercentFree = $drive.freespace / $drive.size * 100
               }
          # Monitor for 10% or less in free space and report accordingly
          if ($obj.PercentFree -lt 10) {
               $obj | Format-Table ComputerName,Drive,@{n='Size';e={'{0:N1}' -f $_.Size}},@{n='Free';e={'{0:N1}' -f $_.Free}},@{n='PercentFree';e={'{0:N1}' -f $_.PercentFree}} | Out-String
               $i++
               }
     }
   
}
)

# Send notification if script finds more than 0 drives with less than 10% free space
if ($i -gt 0)
   {
       foreach ($user in $emailTo)
                {
        echo "Sending Email Notification to $user"
        $smtp = New-Object Net.Mail.SmtpClient($smtpServer)
        $subject = "Server with Low Disk Space"
        foreach ($line in $report)
            {
                $body += "$line "
                }
        Send-MailMessage -to $user -From $emailFrom -SmtpServer $smtpServer -Subject $Subject -Body $body
                }
   }


Sorce

Saturday, January 23, 2016

Remove All Metro Apps via PowerShell in Windows 8

Remove all currently installed Metro Apps:

Get-AppxPackage -AllUsers | Remove-AppxPackage

If you wish to stop them from getting re-installed for the next new user:

Get-AppXProvisionedPackage -online | Remove-AppxProvisionedPackage –online

Friday, January 22, 2016

Disable Java Update

Run as administrator and disable updates :

C:\Program Files\Java\jre6\bin\javacpl.exe

or from Regedit for GPO:

[HKEY_LOCAL_MACHINE\Software\JavaSoft\Java Update\Policy]
«EnableJavaUpdate»=dword:00000000
«EnableAutoUpdateCheck»=dword:00000000

Thursday, January 21, 2016

Windows Update in Audit mode on Windows 8.1

Download:

http://gallery.technet.microsoft.com/scriptcenter/2d191bcd-3308-4edd-9de2-88dff796b0bc

After you have downloaded the module, do the following:
1.)  Copy the whole module folder (after unzipping) to %WINDIR%\System32\WindowsPowerShell\v1.0\Modules

2.) Start up PowerShell ISE as admin from admin tools

3.) Set-ExecutionPolicy RemoteSigned

4.) Import-Module PSWindowsUpdate

5.) Get-WUInstall

6.) The rest should be automated with some prompts

Restart Computer!

Shutdown or Reboot Computer CMD and PowerShell

CMD

Shutdown force :

shutdown -s -f -t 0

Restart Force:

shutdown -r -f -t 0


PowerShell :

Stop-Computer -Force

Restart-Computer -Force

Remote Computer :

 Stop-Computer -ComputerName computer  -Credential username -Force

Wednesday, January 13, 2016

Sharepoint Server Error in '/' Application.

Sharepoint Server Error in '/' Application, check on sql server service SQL Server (MSSQLSERVER). If  service is stopped start it or restart.