Friday, November 30, 2012

Stuck at "Please wait for the Group Policy client..." on Windows 2008 R2

My fellow workmate and myself were working on a two servers that were recently handed over to us.

These servers had multiple nics. Did the usual checked and also change the network provider order to have the "production" network first, because this it the way I roll.

We both joined the servers to the domain, rebooted and everything was fine, could logon etc.
my workmates server was  Stuck at "Please wait for the Group Policy client..."

So did the usual ; trying to view remote event logs, force a remote shutdown (which didn't work).
Decided that it was the fact that the bind order was stopping the logon from working
(Tried remote netsh, that didnt work remotely for some reason, most likely me)

Solutions to fix the problem to allow logon:
Add the blue cable
Add network cable to all NICs on the box (I dont have physical access to the box)
this should give IP address to all NICs


Disable NICs in BIOS
If you in the BIOS disable network card this might also be a option

Remote Connection and Disable the NIC(S) via netsh
  1. download psexec from microsoft
  2. connect to remote server psexec \\<servername> cmd.exe
  3. perform a netsh interface ip show config or ipconfig /all
  4. review the network setup, write down the names of the unused NICs or NICS with 169.254 addresses
  5. go and disable the nics for example netsh interface set interface "Local Area Connection 3" DISABLED
make sure you don't disable the NIC you are working off! (of course)

Solution to fix the issue:
 change the network provider order to have the "production" network first,


Sunday, November 4, 2012

Seven Segment Ardunio Gear Display

Was discussing that there is a upgrade for a stock part that would allow my bike to have a seven segment gear display for my motorcycle.

with leanings from - http://www.stanford.edu/~sanjayd/gear_indicator.pdf

once I know it works might paste it on gstwin.com
here is the code - let me know if I need to pastebin

// assume 7segment anode common
// might need pulldown resistors on the gear inputs 8-13
// might need  a filter,etc for the inputs
// would really like to use a 4 bit to 7 segment toget away from using 1,2,13 inputs


int Gear1 = 8;
int Gear2 = 9;
int Gear3 = 10;
int Gear4 = 11;
int Gear5 = 12;
int Gear6 = 13;
int buttonState1 = 0;
int buttonState2 = 0;
int buttonState3 = 0;
int buttonState4 = 0;
int buttonState5 = 0;
int buttonState6 = 0;


void setup()
{
  pinMode(0,HIGH);
  pinMode(1,HIGH);
  pinMode(2,HIGH);
  pinMode(3,HIGH);
  pinMode(4,HIGH);
  pinMode(5,HIGH);
  pinMode(6,HIGH);
  pinMode(Gear1,INPUT);
  pinMode(Gear2,INPUT);
  pinMode(Gear3,INPUT);
  pinMode(Gear4,INPUT);
  pinMode(Gear5,INPUT);
  pinMode(Gear6,INPUT);

 }

void loop()
{
 PORTD=B0111111; // clear for no data aka netural
 buttonState1 = digitalRead(Gear1);
 buttonState2 = digitalRead(Gear2);
 buttonState3 = digitalRead(Gear3);
 buttonState4 = digitalRead(Gear4);
 buttonState5 = digitalRead(Gear5);
 buttonState6 = digitalRead(Gear6);
 if (buttonState1>0){PORTD=B1111001;} // 1
 if (buttonState2>0){PORTD=B0100100;} // 2
 if (buttonState3>0){PORTD=B0110000;} // 3
 if (buttonState4>0){PORTD=B0011001;} // 4
 if (buttonState5>0){PORTD=B0010010;} // 5
 if (buttonState6>0){PORTD=B0000010;} // 6
 delay(500);        // delay in between reads for stability
}


Sunday, October 28, 2012

Updated MP4 to MP3 Script



Wanted to add some metadata to the mp3 I created from mp4s.
so. But for some reason yet to be investigated windows 8 cant seem to find my metadata.
VLC is happy.


REM FORMAT REQ <name-nospace><space><minus><space><songname><.mp4ext>
REM EG 'coolkids - i like to rock.mp4'
for /f "tokens=1,* delims=-" %%a in ('dir *.mp4 /b') do (call :makemusic %%a "%%b")
goto :eof

:makemusic
set str=%2%
set artist=%1%
REM %str:~2,-5% is used to strip the quotemarks and filename
set title=%str:~2,-5%

REM UPDATE WITH YOUR CORRECT PATH TO FFMPEG
G:\music\ffmpeg.exe -i "%1 - %title%.mp4" -vn -ar 44100 -ac 2 -ab 192000 -f mp3 -metadata title="%title%" -metadata artist="%artist%" "%1 - %title%.mp3"
REM <need command that will allow normalise the sound levels> :eof


Tuesday, October 23, 2012

Chrome shockwave flash Plugin Not Responding

As per http://support.google.com/chrome/bin/answer.py?hl=en&answer=108086
love the known issues !
been getting issue at home and work where it would not respond. @#$@#$
so I have switch over to the system version of flash. (do at ur own risk !)



if you are missing the extra flash (ie only see the pepperflash)
need to download the opera\firefox version of flash

  1. Do you have a different operating system or browser?
  2. Step 1 - choose Windows...
  3. Step 2 - choose Flash Player for Other Browsers
  4. download install,etc
  5. then enable it in chrome://plugins as above



Friday, August 31, 2012

HyperV Expand Disk powershell

Expand Disk

# Assumes that there is only 1 'disk' and 1 object
$TVM = get-vm | where-object { $_.vmelementname -like "*wallace1"}
#Shut down server so that we can expand disk
shutdown-vm  $TVM -wait
#locate the disk
$TDisk=$TVM | get-vmdisk | where-object{ $_.drivename -eq "Hard Drive"}
#Expand the disk
Expand-VHD $TDisk.diskpath 25gb -wait
#Power server back online 
$TVM | Start-vm -wait

next step is to set it to loop thru each server, then power down, expand the C: drive only to 45GB.


$TVM = get-vm
$TVD = $TVM | get-vmdisk | where-object{ $_.drivename -eq "Hard Drive" -AND $_.Controllername -eq "IDE Controller 0" -AND $_.DriveLUN -eq 0}
$TVM |Foreach-object {Shutdown-vm -wait}
$TVD |Foreach-object {Expand-VHD $_.diskpath 45GB -wait}


Expand Disk on Windows 2012 (of course the commands change)

get-vm | get-vmharddiskdrive | foreach-object {resize-vhd $_.path -sizebyte 80GB}

till next time.

Thursday, August 23, 2012

Powershell - remove user from list of groups


#
# remove user from list of groups
#
#

get-content "C:\app\lols.txt" | % {get-adgroup $_ | remove-adgroupmember  -Member dgoodlif -Credential $myadmin -confirm y}

Friday, August 3, 2012

String Stuff with Powershell UNC

Striping servername from a UNC path
PS> $path = \\chicken\scrambled

PS >$servername=$path.Substring(2,$path.Substring(2).indexof("\"))

PS>$servername
chicken

2,$path.Substring(2).indexof("\")
=
2 # start cut @ position 2
$path.Substring(2) #then search from 2 position
.indexof("\") # search for \ in postion

My regex query to get server name
$path -match "[^/\\\]\[]+"
$matches.Values

Tuesday, July 24, 2012

Handy Linux Commands to find out what is going on


lsof -i -n   | same as netstat
last | logon history
uname -a | details about the linux
lspci | details about server hardware detected
w | who is current logged on
su | if you dont know dont use
sudo   | if you dont know dont use

ffmpeg speed, scale and cut\split


Speed it up
ffmpeg.exe -i "mevideo.mp4" -an -vf "setpts=0.1*PTS"  lols.mp4
scale 50% and cut\split after 127 sec
ffmpeg.exe -ss 0 -t 127 -i Lols.mp4 -vf scale=iw/2:-1 test1.mp4

should of done step 2 in 1 go, but gave my cpu something to do..

Tuesday, July 10, 2012

Trusted Domain Authentication issues

Intermittently we had servers that were unable to authenticate to the secondary domain - noobs
It seem that when the PDC2 was restarted the problem was fixed. I believe the servers switched to back to using PDC1 or another DC and were happy.

The trust was verified, etc but I think this was done on PDC1, started to annoy me... so had a look around.

On PDC1 there is a noobs.domainname secondary zone

On PDC2 Primary DNS is itself Secondary DNS being PDC1

On pdc2  was unable to resolve noobs.domainname
ping noobs.domainname
Ping request could not find host noobs.domainname

nltest /SC_Verify:noobs.domainname
Flags: 80Trusted DC NameTrusted DC Connection Status Status = 1311 0x51f ERROR_NO_LOGON_SERVERS
Trust Verification Status = 1311 0x51f
ERROR_NO_LOGON_SERVERS


[FIX] On Pdc2 Added a conditional forwarder for  noobs.domainname  to pdc1

nltest /SC_Verify:noobs.domainname
Flags: b0 HAS_IP  HAS_TIMESERV
Trusted DC Name \\ExternalPDC.noobs.domainname
Trusted DC Connection Status Status = 0 0x0 NERR_
SuccessTrust Verification Status = 0 0x0 NERR_Success

Friday, June 29, 2012

Cleaning up old Windows Drive

Gettings trusted installer errors when trying to delete C:\windows folder
sooo

first tried rename to windows.old incase it a protected folder  - fail
then..
takeown.exe /F D:\windows.old /R /A
icacls "D:\windows.old" /RESET /T /Q /C
rd "D:\Windows.old" /Q /S
or
for /f %i in ('dir /ad /b') do rd %i /s /q


Machine Password

Text file with list of servers WindowsServers.txt

Grab the data

$CAITInfo = Get-Content .\CAITWindowsServers.txt | Foreach {get-adcomputer $_ -properties PasswordLastSet}

Filter and display
$CAITInfo | Sort-Object -descending PasswordLastSet | FT -property DNSHostname,PasswordLastSet

Grab Older than 30 days... which means either problem? or machine password not updating..
$CAITInfo | Sort-Object -descending PasswordLastSet|Where { $_.PasswordLastSet -lt (Get-Date).AddDays(-30)} |
FT -property DNSHostname,PasswordLastSet

To force a PC\server to reset machine password to AD (where not a DC)
nltest.exe /sc_change_pwd:lc.local

wonder if I can do that via powershell :)


Tuesday, June 5, 2012

File Server Error - Windows 8 / windows 2012

While using windows 8 or Windows 2012 was getting Extended Error Connecting to NAS or system error 2148073478 or  ("an extended error has occurred")

Soltuion
Reduce workstation security so that can access NAS, linux file server, etc

HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters
REG_DWORD  RequireSecureNegotiate = 0

Thursday, May 17, 2012

ISA 2006 vs Cache Log vs liveupdate.liveupdatesymantec.com

So removing the ISA proxy @ work noticed while investigating who is still using the 'old' proxy.  Enable  reporting and the daily report for cache use always says "Information not available"

After thinking about  and then googling for the solution to this, didnt get any joy.

Logically it has to be what is set in the web proxy logging options. I remove a heap reduce the data in logs.
there is a options called 'cache information' , enabled that stuff now just need to wait till tomorrow to see if I have WIN.

reviewed the live log notice that' symatec live updates'   liveupdate.liveupdatesymantec.com are loggin as  cache information = 0x106
http://msdn.microsoft.com/en-us/library/aa503433.aspx


0x00000002 Request includes the IF-MODIFIED-SINCE header.
0x00000004 Request includes one of these headers: CACHE-CONTROL:NO-CACHE or PRAGMA:NO-CACHE.
0x00000100 Request includes the CACHE-CONTROL: MAX-AGE, or CACHE-CONTROL: MAX-STALE, or CACHE-CONTROL: MIN-FRESH header.

not so cool.

Think I need to force caching of this website. off to investigate


Tuesday, April 24, 2012

Powershell - Citrix


load citrix ps adding  :  Add-PSSnapin Citrix.XenApp.Commands

Get the number of sessions in the farm:

$FarmRaw = Get-XAFarm
$FarmRaw.SessionCount

Get the number of sessions per app:

$Sessions = Get-XASession -BrowserName "Notepad"
$SessTotal = $sessions.count

Tuesday, April 3, 2012

Powershell : Active Directory user update and rename in 1 line

# tested and used on powershell v3
# 1 Grab username\password
# 2 Grab all users without admin in the name
# 3  For each user
#     a  Modify display name to include (admin)
#     b  Rename AD object to include (admin)
#
#It’s setup to run in a single line because I can
#
$ninja=Get-Credential ; get-aduser -filter 'name -notlike "*Admin*"' -searchbase 'OU=Security - Administrator Accounts,DC=Coolkids,DC=local' -Properties DistinguishedName | %{set-aduser -credential $ninja $_ -displayname ($_.name + " (Admin)"); rename-ADObject $_.DistinguishedName -credential $ninja -NewName ($_.name + " (Admin)")} 



expanded

#get the admin passwords

$ninja=Get-Credential 
#
get-aduser -filter 'name -notlike "*Admin*"' -searchbase 'OU=Security - Administrator Accounts,DC=Coolkids,DC=local' -Properties DistinguishedName | %{set-aduser -credential $ninja $_ -displayname ($_.name + " (Admin)"); rename-ADObject $_.DistinguishedName -credential $ninja -NewName ($_.name + " (Admin)")} 

Wednesday, March 28, 2012

vhd install windows 8


after downloading the window8 (and converting to usb stick )
Insert and reboot
Follow the installation wizard until you get to the point where to select the partition
Hit Shift + F10 to bring up a Dos prompt window.
Type diskpart and press enter. Then,
DISKPART:>create vdisk file=C:\vhd\win8preview.vhd maximum=20000
DISKPART:>select vdisk file=C:\vhd\win8preview.vhd
DISKPART:>attach vdisk
exit and refresh
choose the new disk, ignore any errors about unable to boot

Sunday, March 18, 2012

batch ffmpeg convert mp4 mp3

Not my best FOR loop, quick and nasty.
Had a stack of mp4 videos to convert for the ride home.

mp4mp3.cmd <batch file>

for /f "delims=." %%a in ('dir *.mp4 /b') do G:\music\ffmpeg.exe -i "%%a.mp4" -vn -ar 44100 -ac 2 -ab 192000 -f mp3 "%%a.mp3"

stop that pesky Startup Repair


bcdedit /set {default} bootstatuspolicy ignoreallfailures

Thursday, March 15, 2012

Java vs Terminal Server 2003 - CLSID


Users were experiencing a Red Cross for the applet, yet my administrative account was able to load the applet.

Looks like java or the installation process for java is not writing all the registry keys to HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Wow6432Node\CLSID\{CAFECA-00xx…..

In IE, Java has a catch all applet version – which will always work (aka the latest version)
<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93


But most java call specific versions of java (for example).
<OBJECT classid=”clsid:CAFEEFAC-0015-0000-0013-ABCDEFFEDCBA


The server(s) for some reason didn't have all the keys in classes root, where compared to my windows 7 desktop.

I believe the install for some reason is writing the keys to HKCU instead of HKLM \classes...etc.

So fix is to add all the version to HKEY_LOCAL_MACHINE\SOFTWARE\Classes

http://pastebin.com/YhmwPTq7 contains my fix for 1.6u24 version


btw, Monitoring the registry when tick/untick the “use next generation java” in the java control panel, it just write all the entries to HKCU.

changing the resolution of osx86 on virtualbox

/Library/Preferences/SystemConfiguration/com.apple.Boot.plist copy to desktop...
modify
copy back to original location


Netscaler\AGEE Logon Page multi-tenant

Added another domain\ICA proxy to my AGEE\Netscaler today, as I was rolling out discover that the common logon was going to cause me some grief. As I was sure the other company didn't want the first company's web address on it.

after a quick moment of pondering decided to use javascript to detect the current address and update the page as required.


      <TD width="100%" height=1>
         <script type="text/javascript">
          document.write("<h2> Welcome to " + location.hostname +"</h2>");
         </script>
      </TD>

I don't like using rewrite function
a) because I just dont get regex
b) because...

Sunday, February 26, 2012

Citrix Receiver Fail (sorry more Fail)

I really should post my rageness @ the citrix receiver...

just going to post a image of the part of the fail from citrix receiver

like really...

Saturday, January 28, 2012

OpenTextFile Weird/Bad Characters

 I have just experienced a problem while trying to read a text file by vbscript.
When I echo lines to screen I saw an empty line shows ÿþ, an...

Const ForReading = 1
Const TristateUseDefault=-2
Dim objFSO
Set objFile = objFSO.OpenTextFile("C:\WDSPendingDevices.txt", ForReading, True, TristateUseDefault)

Osman Shener's Blogs and Articles (EN): VBScript : OpenTextFile Weird/Bad Characters: