Search This Blog

Wednesday, December 09, 2015

Exchange 2013 disable auto-mapping of mailboxes with full access

Exchange 2013 disable auto-mapping of mailboxes with full access

# Get all mailboxes in the forest
$Mailboxes = Get-Mailbox -ResultSize unlimited -IgnoreDefaultScope
$ConfirmPreference = 'None'

# Iterate over each mailbox
foreach($Mailbox in $Mailboxes)
{
    try
    {
        # Try to run the example fix against the current $Mailbox
        $FixAutoMapping = Get-MailboxPermission $Mailbox |where {$_.AccessRights -eq "FullAccess" -and $_.IsInherited -eq $false}
        $FixAutoMapping | Remove-MailboxPermission -confirm $false
        $FixAutoMapping | ForEach {Add-MailboxPermission -Identity $_.Identity -User $_.User -AccessRights:FullAccess -AutoMapping $false}
    }
    catch
    {
        # Inform about the error if unsuccessful
        Write-Host "Encountered error: $($Error[0].Exception) on mailbox $($Mailbox.DisplayName)" -ForegroundColor Red
    }
}


Monday, December 07, 2015

Deploy local printers to Windows XP

- Go to a computer without any printer installed, login as administrator and  install all the printers you need to deploy.
- download & run UTFG://printmig.exe go to Actions and click on Backup - save the cab file with the name printers.cab
- download  UTFG://ListComps.exe and run listcomps.exe /D:MY_DOMAIN >> comps.txt
  (replace MY_DOMAIN with the domain you're in) edit the file comps.txt in order to remove unwanted computers, servers...
- in a command prompt type the following line: for /F %r in (comps.txt) do printmig.exe -i -r printers.cab \\%r 
- now watch printmig spawning an instance for every computer and pushing the drivers to all of them
- enjoy a beer 

if before you want to remove ALL the old network printers you can use my (somehow pretty drastic) method of deleting.
Add this .vbs script to the user login or use psexec.exe to launch it:

------------------BEGIN HERE--------------------
' removepr.vbs - Windows NT Logon Script. 
' VBScript - Silently remove ALL network printers
' -----------------------------------------------------------------------'
 
Const ForReading = 1 
Set objFSO = CreateObject("Scripting.FileSystemObject") 
Set objNet = CreateObject("WScript.Network")
Set WshShell = CreateObject("WScript.Shell")
Set wmiLocator = CreateObject("WbemScripting.SWbemLocator")
Set wmiNameSpace = wmiLocator.ConnectServer(objNet.ComputerName, "root\default")
Set objRegistry = wmiNameSpace.Get("StdRegProv")
Const HKEY_CLASSES_ROOT  = &H80000000
Const HKEY_CURRENT_USER  = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS         = &H80000003
strComputer = "."

' If this script already run once for this user, then EXIT
userprrf = WshShell.Environment("PROCESS")("UserProfile") 
'wscript.Echo userprrf
If (objFSO.FileExists(userprrf & "\sctwashere.txt")) Then
Wscript.Quit
Else
blah = "let's have some fun"
End If

' Deletes RegistryKey with all subkeys in Network printers
sPath = "Printers\Connections"
lRC = DeleteRegEntry(HKEY_CURRENT_USER, sPath)
Function DeleteRegEntry(sHive, sEnumPath)
' Attempt to delete key.  If it fails, start the subkey enumration process.
lRC = objRegistry.DeleteKey(sHive, sEnumPath)
' The deletion failed, start deleting subkeys.
If (lRC <> 0) Then
' Subkey Enumerator   
On Error Resume Next   
lRC = objRegistry.EnumKey(HKEY_CURRENT_USER, sEnumPath, sNames)   
For Each sKeyName In sNames      
If Err.Number <> 0 Then Exit For      
lRC = DeleteRegEntry(sHive, sEnumPath & "\" & sKeyName)   
Next   
On Error Goto 0
' At this point we should have looped through all subkeys, trying to delete the key again.   
lRC = objRegistry.DeleteKey(sHive, sEnumPath)
End If
End Function 
'Now let's recreate only the "root" Key we deleted before
objRegistry.CreateKey HKEY_CURRENT_USER,sPath

'Tell something to the user 
'with createobject("wscript.shell")  
'   .popup "All Network Printers are now erased.",1, "Printers Manager"
'end with
------------------END HERE--------------------

Wednesday, December 02, 2015

Configure DHCP options for Nortel IP Phones

In DHCP manager right-click the IPv4 and choose "Set Predefined Options" click "Add", name "blah", data type string, code 128, no description, click OK. Now, in the String field type: Nortel-i2004-A,10.0.0.4:7000,1,10. The BCM IP is here 10.0.0.4, the default port is 7000, the first parameter (action) is always 1, the second parameter (10) is the retry number and pay attention, there is a dot (.) at the end! 

Tuesday, December 01, 2015

Cloud Print on an old local printer

add printer in local cups. make sure it prints. some printers require loading a firmware stub. in my /etc/rc.d/rc.local I have the following line:
/usr/share/hplip/firmware.py -n -p HP_LaserJet_1020



open chrome as a normal user (in our case luser23)
go to chrome://devices/
click add printer. follow instructions.

create the following init script and make sure is executed at startup

cat /etc/init.d/cloudprint

#!/bin/sh
#
# Start / Stop cloudprint daemon
#
# description:  Start / Stop cloudprint daemon
# chkconfig: 345 99 9
#
### BEGIN INIT INFO
# Provides: cloudprint
# Default-Start: 3 4 5
# Short-Description:  Start / Stop cloudprint daemon
# Description:  Start / Stop cloudprint daemon
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

# config file
CONF=/etc/cloudprint.conf

[ -r $CONF ] && . $CONF
[ -r $CONF ] || user=luser23
[ -r $CONF ] || options="/opt/google/chrome/chrome --type=service --enable-cloud-print-proxy --noservice-autorun --noerrdialogs --disk-cache-size=1 --media-cache-size=1 --disk-cache-dir=/tmp/chrome.$$ &"

# See how we were called.
case "$1" in
  start)
 gprintf "Starting cloudprint: "
 /usr/bin/su -l $user -c "$options" && success || failure
 echo
 ;;
  stop)
 gprintf "Shutting down cloudprint:"
 killproc chrome && success || failure
 echo
 ;;
  status)
 status chrome
 ;;
  restart)
 $0 stop
 $0 start
 ;;
  *)
 gprintf "Usage: %s\n" "$0 {start|stop|restart|status}"
 exit 1
esac
exit 0


cat /etc/cloudprint.conf

user=luser23
options="/opt/google/chrome/chrome --type=service --enable-cloud-print-proxy --no-service-autorun --noerrdialogs --disk-cache-size=1 --media-cache-size=1 --disk-cache-dir=/tmp/chrome.$$ &"



or just add in /etc/rc.d/rc.local the following line:
su -l luser23 -c '/opt/google/chrome/chrome --type=service --enable-cloud-print-proxy --no-service-autorun --noerrdialogs --disk-cache-size=1 --media-cache-size=1 --disk-cache-dir=/tmp/chrome.$$ '

Saturday, November 28, 2015

TS-Remote-App: Create a launcher box containing the programs from C:\Users\Public\Desktop

This compiled .ahk will behave like an application launcher for multiple programs from TS in Remote-App mode. If you don't want it to launch the first program automatically, replace || with a single | on line #9.
Enjoy!

;(c)2014 sorin@xxxxxxxx.com under the terms of LGPL v2

#SingleInstance force

files =

Directory = C:\users\public\desktop

Loop, %Directory%\*.lnk, , 1

{

  fullfile = %A_LoopFileName%

  filename := RegExReplace(fullfile,"\.lnk","")

  files = %filename%||%files%

}

Gui, Color, 22BBFF

Gui -Caption +Border +AlwaysOnTop 

Gui, Font, S11, Tahoma

Gui, Add,Button, x255 Y3 w35 h22 gButtonOK, OK

Gui, Add,Button, x10 Y3 w35 h22 gButtonKill, X

Gui Add, ComboBox, X50 Y1 h10 r20 W200 vScript, %files%

Gui Show, x50 y0 H28 W300

ButtonOK:

GuiControlGet Script,, script

if script <>

Run, %Directory%\%script%.lnk, , ,PID

Return

ButtonKill:

Process, Close, %PID%

Sleep, 1000

exitapp

return


return

Friday, November 27, 2015

Upgrade PC*MILER from v23 to v28

Install PCM v28

Import custom places:
1.       Open PC*MILER 28
2.       Go to Tools>Import (Custom Places)
3.       Select File CustomPlaces.txt (in this folder)
4.       Follow File Import Steps - choose the corresponcence between fields, check "first row contain column header"
a.       At the end, be sure to select the option to Add to Custom Place Manager
b. Select the option, prior to adding the location, to overwrite existing places

Transfer the "avoids" in custom road manager:
1. Open PCM28
2. Go to Tools>Convert (Custom Roads)
3. Select the AvoidNa.dat file from your PC*MILER 23 Options folder (is in the same folder with this readme)

Enable the asp COM connection:

IIS MGR - Add Web Site

-Right-Click on ‘Sites’ and choose ‘Add Web Site’
Physical Path:  C:\ALK Technologies\PMW250\Connect\COM\ASP 
Physical path Credentials:  pcmiisuser (Setup using any name within Windows User Accounts – Page 4) 
Binding:  Type-http; IP Address-All Unassigned; Port-8080

Advanced Settings
Physical Path:  C:\ALK Technologies\PMW250\Connect\COM\ASP 
Application Pool:  PCMS_Test (Setup using any name with Application Pools) 
Physical path Credentials:  pcmiisuser (Setup using any name within Windows User Accounts – Page 4) 
 
Application Pool – Advanced Settings 
Name:   PCMS_Test 
Enable 32-Bit Applications:  True 
Managed Pipeline Mode:  Classic 
Identity:  NetworkService 
Loaded User Profile:  False

User Accounts
User Name:  PCMIISUSER 
Domain:  WIN2K8R2X64-VM (Local Machine) 
Group:  Administrators

IIS MGR SITE Permissions (Edit Permissions)
Add ‘PCMIISUSER’ with Full Control

Enable Directory Browsing
-Double-Click on ‘Directory Browsing’ 
-Choose ‘Enable’

Request Filtering
-Double-Click ‘Request Filtering’ 
-Remove extension asa

Make sure COM is registered
-     Browse to: C:\ALK Technologies\PMW250\Connect\COM
-     OVERWRITE pcmsole.dll with the one that comes from v23! (it should be in this folder)
-     Run ‘useCom32.bat’
-     Test with ‘ConnectComTester32’

Start/Restart IIS
-From CMD:  iisreset
OR
-Within IIS : Right-Hand Pane>Manage Web Site>Start

To Run Sample
-Under ‘Manage Web Site’ and ‘Browse Web Site’ 
-Choose ‘Browse *:8080 (http)
-Choose ‘Server_demo.asp’




Enable the Maps ASP COM connection:

IIS MGR - Add Web Site
-Right-Click on ‘Sites’ and choose ‘Add Web Site’
Physical Path:  C:\ALK Technologies\PMW250\MAPPING\ASP 
Physical path Credentials:  pcmiisuser (Setup using any name within Windows User Accounts – Page 4) 
Binding:  Type-http; IP Address-All Unassigned; Port-8081

Advanced Settings
Physical Path:  C:\ALK Technologies\PMW250\MAPPING\ASP 
Application Pool:  PCMMTest (Setup using any name with Application Pools) 
Physical path Credentials:  pcmiisuser (Setup using any name within Windows User Accounts – Page 4) 
 
Application Pool – Advanced Settings 
Name:   PCMM_Test 
Enable 32-Bit Applications:  True 
Managed Pipeline Mode:  Classic 
Identity:  NetworkService 
Loaded User Profile:  False

User Accounts
User Name:  PCMIISUSER 
Domain:  WIN2K8R2X64-VM (Local Machine) 
Group:  Administrators

IIS MGR SITE Permissions (Edit Permissions)
Add ‘PCMIISUSER’ with Full Control

Enable Directory Browsing
-Double-Click on ‘Directory Browsing’ 
-Choose ‘Enable’

Request Filtering
-Double-Click ‘Request Filtering’ 
-Remove extension .asa

Make sure COM is registered
-     Browse to: C:\ALK Technologies\PMW250\Mapping\COM
-     OVERWRITE pcmgole.dll with the one that comes from v27 (it should be in the same folder with this readme)!
-     Run ‘useCom32.bat’
-     Test with ‘C:\ALK Technologies\PCMILER28\Mapping\mapwin32.exe’

Start/Restart IIS
-From CMD:  iisreset
OR
-Within IIS : Right-Hand Pane>Manage Web Site>Start

To Run Sample
-Under ‘Manage Web Site’ and ‘Browse Web Site’ 
-Choose ‘Browse *:8081 (http)
-Choose ‘Mapping_demo.asp’

HP-2530-24G QOS by IP

The phone system will use the ip 192.168.x.21 or .22 (x=2 in branch 1, 6 in branch 2, 8 in branch 3)
The packets coming from those IPs are marked on the switch with DSCP code "EF" (dec 46  bin 101110) - Priority 7 High and treated by Bell's MPLS equipment as class C5 (Voice Signaling and Voice/Telephony)


Running configuration:

; J9776A Configuration Editor; Created on release #YA.15.12.0007
; Ver #04:01.ff.37.XX.XX
hostname "HP-2530-24G"
qos device-priority 192.168.8.20/30 dscp 101110
qos type-of-service ip-precedence
snmp-server community "public" unrestricted
vlan 1
    name "DEFAULT_VLAN"
    untagged 1-28
    ip address 192.168.8.3 255.255.255.0
    exit


Branch 2:

Running configuration:

; J9775A Configuration Editor; Created on release #YA.15.12.0007
; Ver #04:01.ff.37.XX.XX
hostname "HP-2530-48G"
qos device-priority 192.168.6.20/30 dscp 101110
qos type-of-service ip-precedence
ip default-gateway 192.168.6.1
snmp-server community "public" unrestricted
vlan 1
   name "DEFAULT_VLAN"
   untagged 1-52
   ip address 192.168.6.3 255.255.255.0
   exit

ChangeSN Windows XP

' WMI Script - ChangeSN.vbs
'
'sorinakis@g***.com
'**************************

ON ERROR RESUME NEXT
Dim VOL_PROD_KEY
VOL_PROD_KEY = "12345123451234512345" 'put here the real license without dashes
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.RegDelete "HKLM\SOFTWARE\Microsoft\Windows 
NT\CurrentVersion\WPAEvents\OOBETimer"
'delete OOBETimer registry value
for each Obj in 
GetObject("winmgmts:{impersonationLevel=impersonate}").InstancesOf 
("win32_WindowsProductActivation")
result = Obj.SetProductKey (VOL_PROD_KEY)
if err <> 0 then
WScript.Echo Err.Description, "0x" & Hex(Err.Number)
Err.Clear
end if
next

Recreate Offline Address Book - Exchange 2010

1.    Create a new OAB.

a.    Open Exchange Management Console, expand “Organization Configuration” ->”Mailbox”.
b.    Click “Offline Address Book” tab. Right click the blank area and click “New Offline Address Book”.
c.    Type a different OAB name and click “Browse” to select the Exchange 2010 mailbox server as OAB generation server.
d.    Checked “Include the default Global Address Lists” option. As shown below:
e.    Click Next and checked “ Enable Web-base distribution” option and “ Enable public folder distribution” option. Click “Add” to select the default OAB virtual directory.
f.     Click “Next”, click “New” and click “Finish” to complete the creating process.

 

2.    Restart related services.

a.    Restart the “Microsoft Exchange System Attendant” service.
b.    Restart “Microsoft Exchange File Distribution” service.

 

3.    Update the new OAB and set it as default.

a.    Right click the new create OAB and click “Update” to update it manually. Waiting 15-30 minutes for the OAB generate finished.
b.    Right click the new OAB and click “set as default”. Click “Yes” to confirm it.

 

4.    Associate the new OAB to all the users’ mailbox databases.

a.    Expand “Server Configuration” ->”Mailbox”. Right click “mailbox database” and select “Properties”.
b.    Click “Client Settings” tab, under “Offline Address Book” option, click “Browse” button to choose the new created OAB. It will associate the new OAB to the mailbox store. Click “OK”. As shown below.
c.    Let problematic users click “Send/Receive” button on their Outlook client to download OAB, check whether the problem is resolved.

Monday, November 02, 2015

Install HPSUM on an rpm base distro


mount /dev/cdrom /mnt
cp /mnt/compaq/psp/linux /tmp/
cd /tmp/linux
./hpsum

- check for the prerequisite, usually you need expect, kernel-headers, rpm-build, gcc, libnl, redhat-rpm-config, openipmi and net-snmp  either form the redhat installation dvd (rpm -Uvh package), or you can use "yum install package" if you have yum repositories configured.
- you need to manually install hp-snmp-agents package from the hp dvd, it is not installed by hpsum (I presume it's a glitch). hp-snmp-agents needs hp-health (you find them both in the /tmp/linux directory that you just copied from the dvd)
- re-run ./hpsum untill you have no conflicts/unresolved dependecies!
- after installation and reboot run /sbin/hpsnmpconfig - you have to provide only the readonly (public) and the read/write (private) comunity for snmp.
- if everything seems ok, edit /opt/hp/hp-snmp-agents/cma.conf lin 22: trapemail . at the end of the line replace root with your email address - REMEMBER: you need a functional sendmail in order to be able to send emails!

HP Important Note:   The server needs to have 'sudo' installed in order to start or stop the snmp daemon and to send test traps.   'sudo' grants controlled root access to groups or users.   If installed after hp-snmp-agents please run a '/sbin/hpsnmpconfig'. In case of VMware ESX 3.x series, please run '/etc/init.d/hpasm reconfigure' after installation of hpasm.   These buttons will NOT work if 'sudo' is configured to only run when the user is logged into a 'real' tty.   To be able to perform the operations of start, stop, restart of the snmpd daemon, the user must comment out the line 'Defaults requiretty' in the /etc/sudoers file.   See man sudoers for details about the 'requiretty' flag.   If present, this flag will need to be removed from the '/etc/sudoers' configuration file.   The 'send trap' button also requires a tool snmptrap to be present on the system.   This tool is often bundled with the snmp stack (Suse) or in a package called 'net-snmp-util' (Red Hat).