Strict Standards: Redefining already defined constructor for class wpdb in /var/www/myfoto.se/jbits.se/blog/wp-includes/wp-db.php on line 56

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/myfoto.se/jbits.se/blog/wp-includes/cache.php on line 36

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /var/www/myfoto.se/jbits.se/blog/wp-includes/cache.php on line 384

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 541

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 560

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 659

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /var/www/myfoto.se/jbits.se/blog/wp-includes/classes.php on line 684

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/myfoto.se/jbits.se/blog/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /var/www/myfoto.se/jbits.se/blog/wp-content/plugins/code-highlighter/codehighlighter.php on line 42
jbits.se » 2010 » March
Deprecated: preg_replace() [function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in /var/www/myfoto.se/jbits.se/blog/wp-includes/kses.php on line 627

jbits.se

Jörgen Björkmans blog

Archive for March, 2010

Mar
27

Posted by jbjorkman on March 27, 2010 under
Deprecated: preg_replace() [function.preg-replace]: The /e modifier is deprecated, use preg_replace_callback instead in /var/www/myfoto.se/jbits.se/blog/wp-includes/formatting.php on line 82
Windows

Show available wireless networks using netsh (Provides more info than GUI):

netsh wlan show networks mode=bssid

Mar
26

Replace line of text in file recursively

Posted by jbjorkman on March 26, 2010 under Powershell

Powershell command to replace a line of text in files recursively, in this example we disable bitmap cache in all Default.rdp files 

gci "C:\Documents and Settings" -recurse -force -filter default.rdp | % { Set-Content $_.FullName ((gc $_.fullname) -replace "bitmapcache.*","bitmapcachepersistenable:i:0" )}

Mar
19

Microsoft DNS Server - List cache entries

Posted by jbjorkman on March 19, 2010 under Windows

Use the following command to list MS DNS Server cache entries: 

dnscmd DNS_Server_IP /enumrecords /cache domainname

Use /detail for additional info

Mar
16

Script to disable nic powersaving

Posted by jbjorkman on March 16, 2010 under VBScript

Option Explicit
Const HKLM = &H80000002
Dim oShell, oReg, oWMI, aryNICs, oNIC, strNICName, strNICId, intPNPCap, intNewPNPCap,strResultSet oShell = WScript.CreateObject("Wscript.Shell")
Set oReg = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\default:StdRegProv")
Set oWMI = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")

Set aryNICs = oWMI.ExecQuery ("Select * From Win32_NetworkAdapterConfiguration Where IPEnabled = True")

For Each oNIC in aryNICs
strNICid=Mid(oNIC.Caption,6,4)
strNICName=Mid(oNIC.Caption,12,len(oNIC.Caption)-10)
oReg.GetDWORDValue HKLM, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & strNICid & "\","PnPCapabilities",intPNPCap
if (intPNPCap and 56)=56 then
strResult=strResult & "Powersaving already disabled for " & strNICName & vbCRLF
else
oReg.SetDWORDValue HKLM, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & strNICid & "\","PnPCapabilities",(intPNPCap or 56)
oReg.GetDWORDValue HKLM, "SYSTEM\CurrentControlSet\Control\Class\{4D36E972-E325-11CE-BFC1-08002bE10318}\" & strNICid & "\","PnPCapabilities",intNewPNPCap
if intNewPNPCap=intPNPCap then
strResult=strResult & "Couldn't change settings for " & strNICName & vbCRLF
else
strResult=strResult & "Disabling Powersave for " & strNICName & "(" & intPNPCap & ">" & intNewPNPCap & ")" & vbCRLF
end if
end if
Next

oShell.popup strResult,10,"Disabe NIC Powersaving",64

Set oReg = Nothing
Set oWMI = Nothing

Mar
03

Create counter eventlog from commandline

Posted by jbjorkman on March 3, 2010 under Windows

Example of createing a counter eventlog from commandline using logman

md d:\Perflogs
cacls d:\perflogs /e /g "NT AUTHORITY\NETWORK SERVICE":C
logman create counter PerfLog2010 -o D:\Perflogs\ -rf 168:0:0 -si 0:0:15 -f bin -max 512 -v mmddhhmm
logman update PerfLog2010  -c "\Processor(_Total)\% Processor Time" "\Processor(_Total)\Interrupts/sec" "\System\Processor Queue Length" "\System\Context Switches/sec" "\Memory\Available MBytes" "\Memory\Pages Input/sec" "\PhysicalDisk(_Total)\Avg. Disk Queue Length" "\Process(_Total)\Working Set"