Home

    Win7 commandline - Manual restore point

    posted Mar 26, 2013, 2:35 AM by Rasmus Schmidt   [ updated Mar 26, 2013, 2:36 AM ]

    If you want to create a restore point using commandline, it can be done with the following vbscript:
     
    If WScript.Arguments.Count = 0 Then
      Set oShell = CreateObject("Shell.Application")
      oShell.ShellExecute "wscript.exe", """" _
      & WScript.ScriptFullName & """ Run", , "runas", 1
    Else
      Set oWshShell = WScript.CreateObject("WScript.Shell")
      oWshShell.Popup "Creating a SystemRestore point. Please wait.", _
        2, "System Restore", 0
      swinmgmts = "winmgmts:\\.\root\default:Systemrestore"
      GetObject(swinmgmts).CreateRestorePoint _
        "Manual Restore Point", 0, 100
      MsgBox "System Restore Point created", 0, "System Restore"
    End If
     
    restorepoint.vbs is attached in the .zip file below
     

    Win7 - Secundary Logon missing

    posted Mar 15, 2013, 2:30 PM by Rasmus Schmidt   [ updated Mar 26, 2013, 2:43 AM ]

    If your Secundary Logon service has gone missing it can be reinstalled with the following:

    1. Make sure the files runas.exe and seclogon.dll is present in the c:\windows\system32\ folder
        keep in mind that seclogon.dll is a system file that might be hidden, so search for the file rather than browse.
        if the files are not in the folder, they can be copied from the attached .zip file.

    2. set the following registry keys:

     Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\seclogon]
    "DisplayName"="@%SystemRoot%\\system32\\seclogon.dll,-7001"
    "ImagePath"=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,73,00,\
      79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,00,76,00,63,00,68,00,6f,\
      00,73,00,74,00,2e,00,65,00,78,00,65,00,20,00,2d,00,6b,00,20,00,6e,00,65,00,\
      74,00,73,00,76,00,63,00,73,00,00,00
    "Description"="@%SystemRoot%\\system32\\seclogon.dll,-7000"
    "ObjectName"="LocalSystem"
    "ErrorControl"=dword:00000001
    "Start"=dword:00000003
    "Type"=dword:00000020
    "RequiredPrivileges"=hex(7):53,00,65,00,54,00,63,00,62,00,50,00,72,00,69,00,76,\
      00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,52,00,65,00,73,00,74,00,\
      6f,00,72,00,65,00,50,00,72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,\
      00,53,00,65,00,42,00,61,00,63,00,6b,00,75,00,70,00,50,00,72,00,69,00,76,00,\
      69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,00,41,00,73,00,73,00,69,00,67,\
      00,6e,00,50,00,72,00,69,00,6d,00,61,00,72,00,79,00,54,00,6f,00,6b,00,65,00,\
      6e,00,50,00,72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,\
      00,49,00,6e,00,63,00,72,00,65,00,61,00,73,00,65,00,51,00,75,00,6f,00,74,00,\
      61,00,50,00,72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,53,00,65,\
      00,49,00,6d,00,70,00,65,00,72,00,73,00,6f,00,6e,00,61,00,74,00,65,00,50,00,\
      72,00,69,00,76,00,69,00,6c,00,65,00,67,00,65,00,00,00,00,00
    "FailureActions"=hex:80,51,01,00,00,00,00,00,00,00,00,00,03,00,00,00,14,00,00,\
      00,01,00,00,00,c0,d4,01,00,01,00,00,00,e0,93,04,00,00,00,00,00,00,00,00,00

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\seclogon\Parameters]
    "ServiceDll"=hex(2):25,00,77,00,69,00,6e,00,64,00,69,00,72,00,25,00,5c,00,73,\
      00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,73,00,65,00,63,00,6c,00,\
      6f,00,67,00,6f,00,6e,00,2e,00,64,00,6c,00,6c,00,00,00
    "ServiceMain"="SvcEntry_Seclogon"
    "ServiceDllUnloadOnStop"=dword:00000001

    [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\seclogon\Security]
    "Security"=hex:01,00,14,80,a0,00,00,00,ac,00,00,00,14,00,00,00,30,00,00,00,02,\
      00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\
      00,00,02,00,70,00,05,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,\
      05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\
      20,02,00,00,00,00,14,00,dd,01,02,00,01,01,00,00,00,00,00,05,04,00,00,00,00,\
      00,14,00,cd,01,02,00,01,01,00,00,00,00,00,05,06,00,00,00,00,00,14,00,dd,01,\
      02,00,01,01,00,00,00,00,00,05,0b,00,00,00,01,01,00,00,00,00,00,05,12,00,00,\
      00,01,01,00,00,00,00,00,05,12,00,00,00

    3. Reboot your computer

    I have attached a .zip files with a msi installer that sets the above settings for you, also included in the file is the runas.exe and seclogon.dll

     

    Win7: Install windows 7 from USB stick

    posted Mar 13, 2013, 4:27 AM by Rasmus Schmidt   [ updated Mar 26, 2013, 2:44 AM ]

    If you wish to install Windows 7 from a USB stick, here is how its done:

    Insert your USB stick in the computer
    Start a CMD promtp

    write

    1. Diskpart
    2. List disk (your USB stick is probably disk 1)
    3. Select disk 1
    4. clean
    5. create partition primary
    6. active
    7. format fs=fat32 quick
    8. assign (assigns a drive letter to the disk, so you can complete step 9)
    9. Now copy all content from your windows 7 DVD to the USB stick, and you are ready to boot from the stick

    Easy…

    PS: EXCHANGE 2010 SET PERMISSIONS ON RESOURCE MAILBOX

    posted Mar 10, 2013, 2:41 PM by Rasmus Schmidt   [ updated Mar 26, 2013, 2:43 AM ]

    If you want to set permission on a room or equipment mailbox in exchange 2010 to allow everyone to book to resource, autoaccept and decline double bookings, do the following in exchange powershell:

    Set-CalendarProcessing -Identity "5th Floor Conference Room" -AutomateProcessing AutoAccept -AllBookInPolicy $true

    If you want to allow your users to view the calendar, add the resource mailbox as an extra mailbox in Outlook (as admin user) and set permissions on the calendar.

    PS: EXCHANGE 2010 MAIL POLICY ADD MORE DOMAINS IN ONE POLICY

    posted Mar 10, 2013, 2:39 PM by Rasmus Schmidt

    two things in this post, how to add more than one domain in the default policy in powershell, and how to use one initial from first name and one initial from last name.
    Start by adding your domains as accepted domains on the server, when that is done, open Exchange powershell, and add this:

    [PS] C:\Windows\system32>Set-EmailAddressPolicy -Identity “Default Policy” -EnabledEmailAddressTemplates SMTP:%1g%1s@contoso.com,smtp:%1g%1s@fabrikam.com

    it will configure your policy to add first initial from first name and first initial from last name in front of @contoso.com and @fabrikam.com, and add @contoso.com as primary smtp domain.
    SMTP in caps add primary domain, smtp without caps add secondary domain, so if you want to add more domains use smtp without caps.

    if you want to add more initials you can change the %1g to %2g, that will add the first two initials from first name (given name) and if you change %1s to %2s you get the first two initials from last name (sur name).

    SQL SEARCH FOR STRING

    posted Mar 10, 2013, 2:36 PM by Rasmus Schmidt   [ updated Mar 13, 2013, 5:19 AM ]

    SELECT *
    FROM tablename
    WHERE UserName LIKE '%Username%'

    1-6 of 6