Crack Sheet Protection Password in Excel

This routine provides a password to unprotect your worksheet. However, it may not give you the original password that was used.

Open the workbook that has the protected sheet in it. Hit Alt+F11 to view the Visual Basic Editor. Hit Insert-Module and paste this code into the right-hand code window:

Sub PasswordBreaker()
  'Author unknown but submitted by brettdj of www.experts-exchange.com

  Dim i As Integer, j As Integer, k As Integer
  Dim l As Integer, m As Integer, n As Integer
  Dim i1 As Integer, i2 As Integer, i3 As Integer
  Dim i4 As Integer, i5 As Integer, i6 As Integer
  On Error Resume Next
  For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
  For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
  For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
  For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126

 ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
      Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
      Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
  If ActiveSheet.ProtectContents = False Then
      MsgBox "One usable password is " & Chr(i) & Chr(j) & _
          Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
          Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
   ActiveWorkbook.Sheets(1).Select
   Range("a1").FormulaR1C1 = Chr(i) & Chr(j) & _
          Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
          Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
       Exit Sub
  End If
  Next: Next: Next: Next: Next: Next
  Next: Next: Next: Next: Next: Next

End Sub

 

Close the VB Editor window. Navigate to the worksheet you want to unprotect. Hit Tools-Macro-Macros and double-click PasswordBreaker in the list.

source: http://www.theofficeexperts.com/VBASamples/Excel02.htm

A word on disabling a wireless connection when also connected to a physical network

A nice article from David Pracht about the reason to disable the wireless connection when your laptop is wired. The source can be found here.

 


 

We get questions from customers asking how they can disable a wireless connection when they are connected to a physical network. There can be various reasons for wanting to do this but they are often misguided.

First let me say – Windows does not currently have the ability to disable a Wireless connection when connected to a physical network. There are 3rd party solutions and some hardware will have this ability in the BIOS/Advanced settings of the NIC.

While there are legitimate reasons for doing this, really what you should be asking first is, “why?” What is it you are really trying to accomplish? The answers usually come down to either performance or security.

First let’s tackle performance

This usually comes across as something like, “We are concerned that users are connecting over a slower wireless connection when there is a faster physical connection available.”

In reality this should not be an issue as the interface is automatically given a metric when a route is added to the route table and that metric helps decide which route to use if there is more than one path.

Here is a KB article about how XP handles this:

299540 An explanation of the Automatic Metric feature for Internet Protocol routes

http://support.microsoft.com/default.aspx?scid=kb;EN-US;299540

Note: It is done the same way in Vista and Windows 7 but the metric is more granular.

If you are experiencing this type of behavior, you should really be looking closer at the route table and gateway configuration to see if there is an issue there.

There can be times where you have, say, a gigabit network and a wireless N connection that will get the same metric because they essentially report the same speed. If the physical and the wireless network are both on the same subnet and they both have the same gateway Windows can’t determine which interface to use because the metric is the same. So it uses the first one listed in the route table. While you could change the bindings it is not really a good solution and is difficult to automate. You could also change the metric manually with the route command but again this is difficult to automate.

Really you should be considering why the wireless network is in the same subnet. If your wireless network is given its own subnet you will have much better control of the routing in your network and you won’t see these types of issues.

So what if they aren’t in the same subnet? Then it will depend on what is returned via name resolution and the Destination IP address selection process documented here.

http://blogs.technet.com/b/networking/archive/2009/04/17/dns-round-robin-and-destination-ip-address-selection.aspx

Now let’s talk about security

This usually sounds something like “We are concerned users will connected to an unmanaged network in the vicinity and expose the physical network to traffic from said network.” In Windows XP this was a more legitimate concern but in Windows Vista and Windows 7 this is not as applicable because of various security improvements but most specifically the strong host model. You can read more about this at the following link:

http://blogs.technet.com/b/networking/archive/2009/04/25/source-ip-address-selection-on-a-multi-homed-windows-computer.aspx

Further, with Windows Vista and Windows 7, administrators can use Network Permissions in the Wireless GPO to prevent connections to Ad Hoc networks, neighboring networks, or any non-GPO mandated network.

Another concern is just that users will connect to the unmanaged network and send sensitive data over it. The problem with this concern is that all a user has to do is unplug the physical network and they could do the same thing. The truth is that if it is possible to reach the resource over the unmanaged network you can never be sure this won’t happen. You need to either address the routing issue or encrypt the sensitive data. Disabling the wireless NIC is not going to be a complete solution and you could break connectivity in other places that you are not in control of.

So when would you want to disable wireless?

As suggested earlier there are legitimate reasons for wanting to disable the Wireless connection. Perhaps you have a limited number of access points and no ability to expand the wireless side of the network so you want to ensure all physically connected machines use the wired connection. Or maybe your wireless connection only has a limited number of IPs. Again there are other ways to address these issues but if this is the solution you want, 3rd party solutions are currently the best bet.

Summary

In a world that is increasingly connected, disabling connectivity is only going to cause you problems down the road. While there are ways to disable a wireless connection when a machine is plugged into a physical network, you should really think more about why you are trying to do this and address the root of the problem instead. If you find that you do still require this functionality, you will want to research the 3rd party software/hardware options available.

– David Pracht

Powrshell: Show user info from groupmembers

Use the following powershell script to display the samaccount, name, mail information from all groupmembers. Also show if the account is enabled.

 

import-module activedirectory
Get-ADGroupMember “GROUP” | select samaccountname | %{Get-ADUser $_.samaccountname -Properties mail} | format-table samaccountname,name,mail,enabled

 

Point Client Computers to a New Print Server

'This script works well in a login script. When ran from a workstation
'it will loop thru all of the printers installed for the current logged on
'user and if they are connected to the old server they will be removed
'and then remaped to the new server. It will also attempt to descover
'which printer is the default printer in order to reset this if it is one
'of the printers that will be moved.
'
'Note: All of the printers must exist on the new server before this script
' should be run. If not then the printer will simply be removed from
' users profile and the script will not be able to reconnect them.
' "Print Migrator" is a utility that is part of the Windows 2000 and
' Windows 2003 resource kit. This will create all of the printers
' on the new server while maintaining all of their settings including
' print queue security. Keep in mind that for a time you will see
' duplicate printer if you do a search on printers, one advertisec
' from each server.
'
'We used this method to move just over 100 printers from one server to another
'and then ran this script as a logon script in a group policy. We let it run for
'a few days in order to allow for some users who don't logout every day have a
'chance to run it. All of our users profiles were updated and they didn't even
'know it was happening. We then deleted all of the printers from the old server.
'
'Note: The script does not run if you are Terminal serviced or SMS remote controling.

Option Explicit
Dim from_sv, to_sv, PrinterPath, PrinterName, DefaultPrinterName, DefaultPrinter
Dim DefaultPrinterServer, SetDefault, key
Dim spoint, Loop_Counter, scomma
Dim WshNet, WshShell
Dim WS_Printers
DefaultPrinterName = ""
spoint = 0
scomma = 0
SetDefault = 0
set WshShell = CreateObject("WScript.shell")

from_sv = "\\old" 'This should be the name of the old server.
to_sv = "\\new" 'This should be the name of your new server.

'Just incase their are no printers and therefor no defauld printer set
' this will prevent the script form erroring out.
On Error Resume Next
key = "HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device"
DefaultPrinter = LCase(WshShell.RegRead (key))

If Err.Number <> 0 Then
	DefaultPrinterName = ""
else
'If the registry read was successful then parse out the printer name so we can 
' compare it with each printer later and reset the correct default printer
' if one of them matches this one read from the registry.
spoint = instr(3,DefaultPrinter,"\")+1

DefaultPrinterServer = left(DefaultPrinter,spoint-2)

	if lcase(DefaultPrinterServer) = from_sv then
		DefaultPrinterName = mid(DefaultPrinter,spoint,len(DefaultPrinter)-spoint+1)
		scomma = instr(DefaultPrinterName,",")
		DefaultPrinterName = left(DefaultPrinterName,scomma -1)
	end if
end if

Set WshNet = CreateObject("WScript.Network")
Set WS_Printers = WshNet.EnumPrinterConnections

'You have to step by 2 because only the even numbers will be the print queue's
' server and share name. The odd numbers are the printer names.
For Loop_Counter = 0 To WS_Printers.Count - 1 Step 2
	'Remember the + 1 is to get the full path ie.. \\your_server\your_printer.
	PrinterPath = lcase(WS_Printers(Loop_Counter + 1))

	'We only want to work with the network printers that are mapped to the original
	' server, so we check for "\\Your_server".
	if lcase(LEFT(PrinterPath,len(from_sv))) = from_sv then
		'Now we need to parse the PrinterPath to get rhe Printer Name.
		spoint = instr(3,PrinterPath,"\")+1
		PrinterName = mid(PrinterPath,spoint,len(PrinterPath)-spoint+1)
		'Now remove the old printer connection.
		WshNet.RemovePrinterConnection from_sv+"\"+PrinterName
		'and then create the new connection.
		'Do not create c6100
		if lcase(PrinterName) <> "c6100" then
			WshNet.AddWindowsPrinterConnection to_sv+"\"+PrinterName
			'If this printer matches the default printer that we got from the registry then
			' set it to be the default printer.
			if DefaultPrinterName = PrinterName then
				WshNet.SetDefaultPrinter to_sv+"\"+PrinterName
			end if
		end if
	end if
Next
Set WS_Printers = Nothing
Set WshNet = Nothing
Set WshShell = Nothing

' wscript.echo "Printers Migrated"

 

A VBS script to alter client network printers to a new server:

 

source: http://gallery.technet.microsoft.com/scriptcenter/0cb47cac-42d5-4e9d-a85e-6e4b1ef7883c/view/Discussions#content

CLI uninstall Powerchute Business Edition from Windows 2012 Core

Run the following command to deinstall PBE from the Command Line Interface

 

PowerChute Business Edition Agent:

“C:\Program Files (x86)\InstallShield Installation Information\{BCE9F441-9027-4911-82E0-5FB28057897D}\setup.exe” -runfromtemp -l0x0409 AnyText -removeonly

PowerChute Business Edition Server:

“C:\Program Files (x86)\InstallShield Installation Information\{A6491A4A-AAA0-4892-BFEF-ECD6CECE2FF3}\setup.exe” -runfromtemp -l0x0409 AnyText -removeonly

PowerChute Business Edition Console:

“C:\Program Files (x86)\InstallShield Installation Information\{0F86FD09-BA63-4E45-A70B-604C1106C2F2}\setup.exe” -runfromtemp -l0x0409 AnyText -removeonly

 

The corresponding directories in “C:\Program Files (x86)\InstallShield Installation Information” could also be removed

Getting the Directory Size on Remote Servers.

Use the following script:

 

$dataColl = @()#Makes an array, or a collection to hold all the object of the same fields.

foreach ($serverName in (get-content "c:\servers.txt"))

{
$path = "\\$serverName\f$\temp"
$dirSize = Get-ChildItem $path -recurse -force | select Length |Measure-Object -Sum -property length
$dirSize.sum = $dirSize.sum/1GB
$finalResult = "{0:N2} GB" -f $dirsize.sum
$dataObject = New-Object PSObject
Add-Member -inputObject $dataObject -memberType NoteProperty -name "ServerName" -value $serverName
Add-Member -inputObject $dataObject -memberType NoteProperty -name "Dir_Size" -value $finalResult
$dataColl += $dataObject
$dataObject
}

$dataColl | Out-GridView -Title "Remote Directory Scan Results"
$dataColl | Export-Csv -noTypeInformation -path "c:\temp.csv"

 

to workaround the error: Get-ChildItem : The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.

 

use the following script:

$dataColl = @()#Makes an array, or a collection to hold all the object of the same fields.

foreach ($serverName in (get-content "c:\servers.txt"))

{
$path = "\\$serverName\f$\data"
#$dirSize = Get-ChildItem $path -recurse -force | select Length |Measure-Object -Sum -property length
$dirSize = (robocopy.exe $path $env:Temp /zb /e /l /r:1 /w:1 /nfl /ndl /nc /fp /bytes /np /njh | ? {$_ -match "Bytes :"}).trim().split(" ")[2]
$dirsum = $dirSize/1GB
$finalResult = "{0:N2} GB" -f $dirsum
$dataObject = New-Object PSObject
Add-Member -inputObject $dataObject -memberType NoteProperty -name "ServerName" -value $serverName
Add-Member -inputObject $dataObject -memberType NoteProperty -name "Dir_Size" -value $finalResult
$dataColl += $dataObject
$dataObject
}

$dataColl | Out-GridView -Title "Remote Directory Scan Results"
$dataColl | Export-Csv -noTypeInformation -path "c:\temp.csv"

 

source: http://thescriptlad.com/2011/04/16/get-remote-dir-size/

Excel – Count colored cells

Copy and paste the following code into you VBA project (alt+f10 in excel)

 

Public Function cell_colour(Cell_Check As Range) As Long
cell_colour = Cell_Check.Interior.Color
End Function

Public Function count_colour(Count_Range As Range, Colour As Long) As Long
Dim x As Range
count_colour = 0
For Each x In Count_Range
If x.Interior.Color = Colour Then
count_colour = count_colour + 1
End If
Next x
End Function

 

With the formula “count_colour(B1:B10;cell_colour($A$1))” you can count the colorourd cells in B1 to B10 with the same colour as the cell in A1

KMS Client Setup Keys

Computers that are running volume licensing editions of Windows 8, Windows Server 2012, Windows 7, Windows Server 2008 R2, Windows Vista, and Windows Server 2008 are, by default, KMS clients with no additional configuration needed.

If you are converting a computer from a KMS host, MAK, or retail edition of Windows to a KMS client, install the applicable setup key (GVLK) from the following tables

To install a client setup key, open an administrative command prompt on the client, type slmgr /ipk <setup key> and press ENTER.

Operating system edition KMS Client Setup Key
Windows 8 Professional NG4HW-VH26C-733KW-K6F98-J8CK4
Windows 8 Professional N XCVCF-2NXM9-723PB-MHCB7-2RYQQ
Windows 8 Enterprise 32JNW-9KQ84-P47T8-D8GGY-CWCK7
Windows 8 Enterprise N JMNMF-RHW7P-DMY6X-RF3DR-X2BQT
Windows Server 2012 Core BN3D2-R7TKB-3YPBD-8DRP2-27GG4
Windows Server 2012 Core N 8N2M2-HWPGY-7PGT9-HGDD8-GVGGY
Windows Server 2012 Core Single Language 2WN2H-YGCQR-KFX6K-CD6TF-84YXQ
Windows Server 2012 Core Country Specific 4K36P-JN4VD-GDC6V-KDT89-DYFKP
Windows Server 2012 Server Standard XC9B7-NBPP2-83J2H-RHMBY-92BT4
Windows Server 2012 Standard Core XC9B7-NBPP2-83J2H-RHMBY-92BT4
Windows Server 2012 MultiPoint Standard HM7DN-YVMH3-46JC3-XYTG7-CYQJJ
Windows Server 2012 MultiPoint Premium XNH6W-2V9GX-RGJ4K-Y8X6F-QGJ2G
Windows Server 2012 Datacenter 48HP8-DN98B-MYWDG-T2DCC-8W83P
Windows Server 2012 Datacenter Core 48HP8-DN98B-MYWDG-T2DCC-8W83P
Operating system edition KMS Client Setup Key
Windows 7 Professional FJ82H-XT6CR-J8D7P-XQJJ2-GPDD4
Windows 7 Professional N MRPKT-YTG23-K7D7T-X2JMM-QY7MG
Windows 7 Professional E W82YF-2Q76Y-63HXB-FGJG9-GF7QX
Windows 7 Enterprise 33PXH-7Y6KF-2VJC9-XBBR8-HVTHH
Windows 7 Enterprise N YDRBP-3D83W-TY26F-D46B2-XCKRJ
Windows 7 Enterprise E C29WB-22CC8-VJ326-GHFJW-H9DH4
Windows Server 2008 R2 Web 6TPJF-RBVHG-WBW2R-86QPH-6RTM4
Windows Server 2008 R2 HPC edition TT8MH-CG224-D3D7Q-498W2-9QCTX
Windows Server 2008 R2 Standard YC6KT-GKW9T-YTKYR-T4X34-R7VHC
Windows Server 2008 R2 Enterprise 489J6-VHDMP-X63PK-3K798-CPX3Y
Windows Server 2008 R2 Datacenter 74YFP-3QFB3-KQT8W-PMXWJ-7M648
Windows Server 2008 R2 for Itanium-based Systems GT63C-RJFQ3-4GMB6-BRFB9-CB83V
Operating system edition KMS Client Setup Key
Windows Vista Business YFKBB-PQJJV-G996G-VWGXY-2V3X8
Windows Vista Business N HMBQG-8H2RH-C77VX-27R82-VMQBT
Windows Vista Enterprise VKK3X-68KWM-X2YGT-QR4M6-4BWMV
Windows Vista Enterprise N VTC42-BM838-43QHV-84HX6-XJXKV
Windows Web Server 2008 WYR28-R7TFJ-3X2YQ-YCY4H-M249D
Windows Server 2008 Standard TM24T-X9RMF-VWXK6-X8JC9-BFGM2
Windows Server 2008 Standard without Hyper-V W7VD6-7JFBR-RX26B-YKQ3Y-6FFFJ
Windows Server 2008 Enterprise YQGMW-MPWTJ-34KDK-48M3W-X4Q6V
Windows Server 2008 Enterprise without Hyper-V 39BXF-X8Q23-P2WWT-38T2F-G3FPG
Windows Server 2008 HPC RCTX3-KWVHP-BR6TB-RB6DM-6X7HP
Windows Server 2008 Datacenter 7M67G-PC374-GR742-YH8V4-TCBY3
Windows Server 2008 Datacenter without Hyper-V 22XQ2-VRXRG-P8D42-K34TD-G3QQC
Windows Server 2008 for Itanium-Based Systems 4DWFP-JF3DJ-B7DTH-78FJB-PDRHK

 

source: http://technet.microsoft.com/en-us/library/jj612867.aspx

 

Using the Exchange 2010 SP1 and SP2 Mailbox Export features for Mass Exports to PST files

 

Export:

set-adserversettings -viewentireforest $true

new-mailboxexportrequest -mailbox “mailboxname” -Isarchive -filepath \\uncpath\archive.pst -mrsserver server

new-mailboxexportrequest -mailbox “mailboxname” -filepath \\uncpath\mailbox.pst -mrsserver server

 

Status:

get-mailboxexportrequest -mailbox “mailboxname” | Get-MailboxExportRequestStatistics

 

See http://www.stevieg.org/2010/07/using-the-exchange-2010-sp1-mailbox-export-features-for-mass-exports-to-pst/ for a mass export