• Köra ett Script från en regel – Exempel

    Problem:

    Jag vill kunna köra ett script från en regel i Outlook

     

    Lösning:

     

    – Starta upp Outlook

    – Klicka på Visual Basic Editor under Tools/Macros i menyn

    – Dubbelklicka på ThisOutlookSession

    – Kopiera scriptet nedan och klistra in det i fönstret som öppnades när du dubbelklickade på ThisOutlookSession

    – Stäng Visual Basic Editorn och återgå till Outlook

    – Gå in på Tools/Rules and Alerts

    – Klicka på New Rule

    – Välj Start from blank rule, se till att ”Check messages when they arrive” är iklickat och klicka ”Next”

    – Klicka i ”From People or Distribution List”

    – Klicka på “People or Distribution List”  I det under fönstret

    – I fältet ”From” längst ned skriver du in adress som mailen kommer ifrån. Klicka sedan ”Next”.

    – Bocka i ”Run a script”

    – Klicka på “a script” i det under fönstret och välj ”Project1.ThisOutlookSession.Save_Gas_Matters_Attach” och klicka ”Ok” Klicka sedan Next

    – Klicka Finish

     

    Förutsättning för att ett Script skall fungera att köra från en regel:

     

    A macro for use with a rule must be a Public Sub with a MailItem or MeetingItem argument, e.g.:

    Public Sub SaveAttachmentsToFolder(objMail as MailItem)
        ‘ code to save attachments in the objMail message
    End Sub

     

    Exempel Script

     

    Script för att automatiskt spara attachments

     

    Sub Save_Gas_Matters_Attach(objMsg As MailItem)

    Dim myItems, myItem, myAttachments, myAttachment As Object

    Dim myOrt As String

    Dim myOlApp As New Outlook.Application

    myOrt = “C:” ‘destination folder

    On Error GoTo ErrHandler

    Set myItem = objMsg

    Set myAttachments = myItem.Attachments

    ‘if there are some…

    If myAttachments.Count > 0 Then

    ‘add remark to message text

    myItem.Body = myItem.Body & vbCrLf & “Saved Attachment(s):” & vbCrLf

    ‘for all attachments do…

    For i = 1 To myAttachments.Count

    ‘save them to destination

    myAttachments(i).SaveAsFile myOrt & myAttachments(i).DisplayName

    ‘add name and destination to message text

    myItem.Body = myItem.Body & “File: “ & myOrt & myAttachments(i).DisplayName & vbCrLf

    Next i

    End If

    GoTo SkipErrorHandlingBit

    ErrHandler:

    ‘ Error has occured, put a message in the email text.

    myItem.Body = myItem.Body & vbCrLf & “File has not been saved!” & vbCrLf

    SkipErrorHandlingBit:

    ‘save item without attachments

    myItem.Save

    ‘free variables

    Set myItem = Nothing

    Set myAttachments = Nothing

    End Sub

    Sub Reportave()

    Dim oApp As Application

    Dim oNS As NameSpace

    Dim oMsg As Object

    Dim oAttachments As Outlook.Attachments

    Dim lngCount As Single

    Set oApp = New Outlook.Application

    Set oNS = oApp.GetNamespace(“MAPI”)

    Set oFolder = oNS.GetDefaultFolder(olFolderInbox)

    For Each oMsg In
    oFolder.Items

    lngCount = oMsg.Attachments.Count

    If lngCount > 0 Then

    For i = lngCount To 1 Step -1

    ‘ Save attachment before deleting

    tmpfile = oMsg.Attachments.Item(i)

    tmpfile = “c:” & tmpfile

    tmpsender = oMsg.SenderName

    tmpmessage = MsgBox(“Guardando archivo “ & Trim(tmpfile) & “enviado por “ & tmpsender, vbOKOnly)

    oMsg.Attachments.Item(i).SaveAsFile tmpfile

    tmpmessage = MsgBox(“Eliminando adjunto “ & Trim(tmpfile), vbOKOnly)

    oMsg.Attachments.Remove i

    Next i

    End If

    Next

    End Sub

  • Generating a new MAC address in VmWare GSX

    Problem:

    I accidentally told VmWare not to generate a new id for a copied virtual machine. When I try to start both the oliginal and the copy the network traffic doesn’t work since both of the machines have the same MAC adress.

    Since the address is generated from the identifier it will generate the same MAC each time.

    Solution:

    Erase the following lines in .vmx file for the virtual machine.

    uuid.location = “56 4d ef 90 5e ea 44 ce-4b 98 58 85 8d 6c d0 5f”
    uuid.bios = “56 4d 2b 7b d8 44 e0 91-3c 4c 3e fc a6 a2 d2 e0”
    ethernet0.generatedAddress = “00:0c:29:a2:d2:e0”
    ethernet0.generatedAddressOffset = “0”

  • Solving Netdiag Problems

    [WARNING] At least one of the <00> ‘WorkStation Service’, <03> ‘Messenger Service’, <20> ‘WINS’ names is missing.

       Since this a warning it is safe to ignore

    [Fatal] Secure channel to domain ‘ourdomain’ is broken.

       Reset the secure channel to the domain with netdom reset computer /domain:domain

  • Use PIX as DHCP Server

    :——————————————————Create DHCP Scope

    dhcpd address [start address]-[edn address] inside

    :——————————————————Create DNS Option

    dhcpd dns [primary dns] [secondary dns]

    :——————————————————Create domain Option

    dhcpd domain domain.com

    :——————————————————Create DNS Option Scope

    dhcpd wins [primary wins] [secondary wins]

    :——————————————————Set Lease time

    dhcpd lease 3600

    :——————————————————Set ping timeout for server when testing for free address

    dhcpd ping_timeout 750

    :——————————————————Enable DHCP on inside interface

    dhcpd enable inside

  • Enable HTTPS Management

    :——————————————————Enables HTTP Server

    http server enable

    :——————————————————Restricts Access to PDM

    http 192.168.42.13 255.255.255.255 inside

  • Misc Commands

    write erase Factory Resets the pix
    reload Reboots the Pix
    isakmp nat-traversal 20 Enable NAT Traversal
    username [username] password [password] privilege 5 Adds a user for authentication to the Pix
  • Basic Config med DHCP WAN

    :    Basic Cisco Config with DHCP WAN
    :
    :    By: Johan Persson
    :    Date: 2005-01-04

    :——————————————————change Duplexmode
    interface ethernet0 100full
    interface ethernet1 100full

    nameif ethernet0 outside security0
    nameif ethernet1 inside security100
    fixup protocol dns maximum-length 512
    fixup protocol ftp 21
    fixup protocol h323 h225 1720
    fixup protocol h323 ras 1718-1719
    fixup protocol http 80
    fixup protocol rsh 514
    fixup protocol rtsp 554
    fixup protocol sip 5060
    fixup protocol sip udp 5060
    fixup protocol skinny 2000
    fixup protocol smtp 25
    fixup protocol sqlnet 1521
    fixup protocol tftp 69
    pager lines 24
    mtu outside 1500
    mtu inside 1500
    pdm history enable
    arp timeout 14400

    :——————————————————change enable password
    enable password password                

    :——————————————————change telnet password
    passwd password                        

    :——————————————————change hostname
    hostname host                        

    :——————————————————change domain
    domain-name domain.com                

    :——————————————————change ip address
    ip address outside dhcp setroute
    ip address inside 192.168.200.1 255.255.255.0

    :——————————————————setup PAT for outgoing trafic

    global (outside) 10 interface
    nat (inside) 10 0.0.0.0 0.0.0.0 0 0

  • Basic Config

    :    Basic Cisco Config
    :
    :    By: Johan Persson
    :    Date: 2005-01-04

    :——————————————————change Duplexmode
    interface ethernet0 100full
    interface ethernet1 100full

    nameif ethernet0 outside security0
    nameif ethernet1 inside security100

    fixup protocol dns maximum-length 512
    fixup protocol ftp 21
    fixup protocol h323 h225 1720
    fixup protocol h323 ras 1718-1719
    fixup protocol http 80
    fixup protocol rsh 514
    fixup protocol rtsp 554
    fixup protocol sip 5060
    fixup protocol sip udp 5060
    fixup protocol skinny 2000
    fixup protocol smtp 25
    fixup protocol sqlnet 1521
    fixup protocol tftp 69
    pager lines 24
    mtu outside 1500
    mtu inside 1500
    pdm history enable
    arp timeout 14400

    :——————————————————change enable password
    enable password password                

    :——————————————————change telnet password
    passwd password                        

    :——————————————————change hostname
    hostname host                        

    :——————————————————change domain
    domain-name domain.com                

    :——————————————————change ip address
    ip address outside 10.0.105.200 255.255.0.0        
    ip address inside 192.168.200.1 255.255.255.0

    :——————————————————change global outside pool
    global (outside) 1 10.0.105.10 interface            
    nat (inside) 1 0.0.0.0 0.0.0.0 0 0

    :——————————————————change default gateway
    route outside 0.0.0.0 0.0.0.0 10.0.1.10 1        

  • Datorer…

    Jag arbetar som konsult och har vid flera tillfällen behov att spara ner länkar, filer och lösningar på problem. Dessa kommer att hamna i denna kategori.

  • Min Blog…

    Eftersom min stackars server packade ihop för ett tag sedan bestämde jag mig för att låna lite plats på Stisses server för att sätta upp en enkel ersättare tills att min server är tillbaka på fötterna igen. Jag konstaterade att en Blog förmodligen var det bästa valet eftersom jag inte skulle hinna knåpa ihop ASP sidorna för att få det att fungera.

    Jag testade och kollade på en del olika mjukvaror för att hitt anågon som jag tyckte skulle fungera. Mina önskemål var som följer:

    • Enkel att hantera
    • Skulle inte kräva SQL server (eftersom detta inte fanns på servern)
    • Det skulle gå att lämna entires halvfärdiga utan att det syntes
    • Skulle inte kräva PHP eftersom jag inte har det minsta koll på det 🙂

    De olika programvaror jag testade var. Tänkte jag skulle dela med mig av länkarna jag hittade:

    Alla paketen var helt ok men den jag föll för var dasBlog…