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
Friday, August 3, 2012
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
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
Labels:
active directory,
DNS,
domain trust,
sites and services,
solved,
tactical fix
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
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
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
Soltuion
Reduce workstation security so that can access NAS, linux file server, etc
HKLM:\SYSTEM\CurrentControlSet\Services\LanmanWorkstation\Parameters
REG_DWORD RequireSecureNegotiate = 0
Labels:
extended error,
file systems,
fixed,
NAS,
solved,
windows 2012,
windows 8
Subscribe to:
Posts (Atom)