Enviando post automatico
Cesar Romero
Sistemas
Arabela El Salvador, S.A. de C.V.
Manejo de Ficheros PowerShell
Objetivo .
- Mover todas las carpetas que contengan *.mp3 a una carpeta llamada MUSIC
-Eliminar las carpetas que esten vacias
- Crear un playlist de todas las canciones
Entorno de ejecucion PowerShell ISE
MOVIENDO CARPETAS
$Path = "J:\"
$List = get-childitem -path $Path -recurse *.mp3 | where{$_.Name -notlike "button*"}
foreach($file in $list){
$MovePath = (join-path -path 'J:\MUSIC' -childpath $file.FullName.SubString(10))
$MoveDirectory = (join-path -path 'J:\MUSIC' -childpath $file.DirectoryName.SubString(10))
new-item $MoveDirectory -type directory -ea SilentlyContinue
move-item -Path $file.FullName -destination $MovePath
}
Directorio: J:\MUSIC\2Octubre2010\COMPLETE\2008Procedo a ejecutar el ISE como Administrador
Mode LastWriteTime Length Name
---- ------------- ------ ----
d---- 24/02/2011 04:57 p.m. Presentacion de Mercadeo 3er Qtr
Move-Item : Acceso denegado a la ruta de acceso.
En línea: 17 Carácter: 10
+ move-item <<<< -Path $file.FullName -destination $MovePath + CategoryInfo : PermissionDenied: (J:\22Octubre201...For Love(1).mp3:FileInfo) [Move-Item], UnauthorizedAccessException + FullyQualifiedErrorId : MoveFileInfoItemUnauthorizedAccessError,Microsoft.PowerShell.Commands.MoveItemCommand
Set-ExecutionPolicy Unrestricted

gci -Path J:\ -include *.mp3 -r | ? {$_.fullname -notmatch 'J:\\MUSIC'} | Format-Table -groupby DirectorioMode LastWriteTime Length NameEtc
---- ------------- ------ ----
-a--- 17/02/2010 05:21 p.m. 6531072 14 Amiga [Ft. Yuridia].mp3
-a--- 01/06/2008 10:50 p.m. 13607120 Dr.Ottoniel Rios Paredes -Testimonio 1984 [17-03-84].mp3
-a--- 29/10/2009 08:27 a.m. 2766558 Una_Noche_De_Amor_-_[www.escuchamusica.com.mx].mp3
-a--- 21/08/2006 04:44 p.m. 4221056 07 Te Alaben [Salmo 67].mp3
-a--- 29/10/2009 08:38 a.m. 6469801 09 Abre Mis Ojos [Con Danilo Montero].mp3
-a--- 29/10/2009 08:39 a.m. 5894144 03 Ven Te Necesito [Lilly Goodman (Duo)].mp3
-a--- 01/05/2007 05:04 p.m. 6879232 06 Enmorame [Abel Zavala (Duo)].mp3
-a--- 15/12/2009 07:21 a.m. 3453897 Nirvana - You Know Your Right [Studio Full].mp3
-a--- 06/02/2009 09:15 a.m. 4579544 paris hilton - [paris] - nothing in this world(2).mp3
-a--- 03/08/2009 10:38 p.m. 3463714 (MeretteMusic.NeT) [MoNeGrItOxX] - Arcangel - Pa Que La Pases Bien (El Diario De Un Sonador) (MeretteMusic.NeT) [MoNeGrItOxX].mp3
-a--- 24/09/2009 05:50 p.m. 6286151 (MeretteMusic.NeT) [MoNeGrItOxX] - Tito El bambino Ft. Siklio - El Tra (Official Remix) (MeretteMusic.NeT) [MoNeGrItOxX].mp3
-a--- 03/08/2009 11:28 p.m. 2152455 Lloro Por Ti - Wisin & Yandel Ft. Enrique Iglesias [Video].mp3
-a--- 03/08/2009 11:46 p.m. 3531311 Mr[1]. Presidente - Coco Jambo.mp3
-a--- 16/12/2009 06:11 p.m. 15970383 Avicii - Dukkha (Original Mix) [www.livingelectro.com].mp3
-a--- 07/01/2010 02:33 p.m. 7399120 Chris Ortega Vs Lady Gaga - Just Dance (Dj Vartan Mash Down Mix)[www.livingelectro.com].mp3
-a--- 29/12/2009 02:02 a.m. 8688412 Ke$ha - Take It Off [www.livingelectro.com].mp3
-a--- 01/12/2009 11:40 p.m. 14186665 Pryda - Pjanoo 2k10 (South Freak Remix)[www.livingelectro.com].mp3
-a--- 23/10/2010 02:06 p.m. 6159049 08. Te Vas [Balada].mp3
-a--- 23/10/2010 02:07 p.m. 7229076 08 Ya No Queda Nada [Reggaeton].mp3
-a--- 23/10/2010 02:07 p.m. 10060404 09 Fabricando Fantasias [Balada].mp3
-a--- 23/10/2010 02:07 p.m. 5462343 10. Esa Boquita [Balada].mp3
-a--- 23/10/2010 02:07 p.m. 6407766 11. Si Yo Fuera El [Reggaeton].mp3
-a--- 23/10/2010 02:08 p.m. 4831762 09 Mi Mayor Sacrificio [Ft. Marco Antonio Solís].mp3
-a--- 18/02/2010 04:44 p.m. 3223135 arcangel - bonita [original official](2)207.mp3
-a--- 24/03/2010 01:19 a.m. 3911680 [salsa aprile 2007] calambuco - metele.mp3
-a--- 26/07/2010 04:20 a.m. 5321 04- ramsteim - bestrafe_mich[1].mp3
-a--- 26/07/2010 02:30 a.m. 4867847 06-[buck dich].mp3
-a--- 09/08/2006 08:06 a.m. 12095488 depeche mode & rammstein - personal jesus [covenant remix]175.mp3
-a--- 20/08/2010 10:03 a.m. 3186147 [Five] - Keep On Moving.mp3
-a--- 02/09/2008 11:52 p.m. 7811597 01_santana_-_black_magic_woman.mp3
-a--- 02/09/2008 11:55 p.m. 6799882 02_santana_-_oye_como_va.mp3
-a--- 02/09/2008 11:54 p.m. 6578694 03_santana_-_jingo.mp3
-a--- 02/09/2008 11:54 p.m. 9042267 04_santana_-_guajira.mp3
-a--- 02/09/2008 11:54 p.m. 5824983 05_santana_-_evil_ways.mp3
-a--- 02/09/2008 11:54 p.m. 6827852 06_santana_-_hannibal.mp3
-a--- 02/09/2008 11:51 p.m. 7059335 07_santana_-_i_love_you_much_too_much.mp3
-a--- 02/09/2008 11:54 p.m. 5254745 08_santana_-_everythings_coming_our_way.mp3
-a--- 02/09/2008 11:54 p.m. 7036647 09_santana_-_hold_on.mp3
-a--- 02/09/2008 11:54 p.m. 7605202 10_santana_-_ill_be_waiting.mp3
-a--- 02/09/2008 11:52 p.m. 8790248 11_santana_-_no_one_to_depend_on.mp3
-a--- 02/09/2008 11:54 p.m. 5701474 12_santana_-_winning.mp3
-a--- 02/09/2008 11:54 p.m. 7562548 13_santana_-_europa_earths_cry_heavens_smile.mp3
-a--- 03/11/2010 05:39 p.m. 6266355 01-luis.enrique-yo.no.se.manana.[www.CienPorCienMusic.com].mp3
Microsoft actualizo automáticamente la versión 2.0 de PowerShell.


PS J:\>$objShell = New-Object –com Shell.Application
PS J:\>$objShell | Get-Member
TypeName: System.__ComObject#{866738b9-6cf2-4de8-8767-f794ebe74f4e}
Name MemberType Definition
---- ---------- ----------
AddToRecent Method void AddToRecent (Variant, string)
BrowseForFolder Method Folder BrowseForFolder (int, string, int, Variant)
CanStartStopService Method Variant CanStartStopService (string)
CascadeWindows Method void CascadeWindows ()
ControlPanelItem Method void ControlPanelItem (string)
EjectPC Method void EjectPC ()
Explore Method void Explore (Variant)
ExplorerPolicy Method Variant ExplorerPolicy (string)
FileRun Method void FileRun ()
FindComputer Method void FindComputer ()
FindFiles Method void FindFiles ()
FindPrinter Method void FindPrinter (string, string, string)
GetSetting Method bool GetSetting (int)
GetSystemInformation Method Variant GetSystemInformation (string)
Help Method void Help ()
IsRestricted Method int IsRestricted (string, string)
IsServiceRunning Method Variant IsServiceRunning (string)
MinimizeAll Method void MinimizeAll ()
NameSpace Method Folder NameSpace (Variant)
Open Method void Open (Variant)
RefreshMenu Method void RefreshMenu ()
ServiceStart Method Variant ServiceStart (string, Variant)
ServiceStop Method Variant ServiceStop (string, Variant)
SetTime Method void SetTime ()
ShellExecute Method void ShellExecute (string, Variant, Variant, Variant, Variant)
ShowBrowserBar Method Variant ShowBrowserBar (string, Variant)
ShutdownWindows Method void ShutdownWindows ()
Suspend Method void Suspend ()
TileHorizontally Method void TileHorizontally ()
TileVertically Method void TileVertically ()
ToggleDesktop Method void ToggleDesktop ()
TrayProperties Method void TrayProperties ()
UndoMinimizeALL Method void UndoMinimizeALL ()
Windows Method IDispatch Windows ()
WindowsSecurity Method void WindowsSecurity ()
WindowSwitcher Method void WindowSwitcher ()
Application Property IDispatch Application () {get}
Parent Property IDispatch Parent () {get}
PS J:\> Get-Help Get-Member -full
Para crear los alias simplemente escribimos
# PowerShell crear alias
Clear-Host
new-alias xcopy copy-Item
# O escribiendo lo siguiente
Set-Alias xcopy copy-Item # works just as well

A quien no le gusta "lo bueno" pero diría mi amigo Galo pero "lo bueno" es relativo ..ahí entra la polémica , pero la clave es: “ si es para mejorar hacerlo!!!.”
Estos días como he estado trabajando en As/400 y Windows vista solo quiero sustentar la estabilidad y la tranquilidad que puedes pasar si tienes algunos puntos como.
Primero que el sistema no se quede colgado ahí está un screenshot del uptime
![]()
Lastimosamente ahora vengo y perdí el uptime por que el sistema decidió que había actualizaciones importantes y lo reinicio hace 4 horas.
Y me muestra esta imagen
Me interesa saber que procesos han cambiado me voy al Kaspersky
02/10/2010 11:07:11 a.m. Process C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE (PID: 5220): suspicious action. Process is trying to write list of modules executed during system startup (key: HKEY_USERS\S-1-5-21-515967899-1336601894-839522115-3905_CLASSES\mailto\shell\open\command, value: , data: "C:\PROGRA~1\MICROS~1\Office12\OUTLOOK.EXE" -c IPM.Note /m "%1").
02/10/2010 11:07:11 a.m. Process C:\Program Files\Microsoft Office\Office12\OUTLOOK.EXE (PID: 5220): attempt to write list of modules executed during system startup (key: HKEY_USERS\S-1-5-21-515967899-1336601894-839522115-3905_CLASSES\mailto\shell\open\command, value: , data: "C:\PROGRA~1\MICROS~1\Office12\OUTLOOK.EXE" -c IPM.Note /m "%1") allowed.
05/10/2010 08:55:34 a.m. Update completed successfully
05/10/2010 11:01:13 a.m. Update completed successfully
06/10/2010 11:02:21 a.m. Update completed successfully
06/10/2010 04:10:12 p.m. The application C:\PROGRAM FILES\MICROSOFT OFFICE\OFFICE12\OUTLOOK.EXE has been changed
07/10/2010 11:01:54 a.m. Update completed successfully
08/10/2010 11:02:10 a.m. Update completed successfully
09/10/2010 11:02:16 a.m. Update completed successfully
10/10/2010 11:01:59 a.m. Update completed successfully
14/10/2010 03:24:55 a.m. Protection of your computer started.
14/10/2010 08:44:51 a.m. The application C:\PROGRA~1\MICROS~1\OFFICE12\WINWORD.EXE has been changed
14/10/2010 08:47:47 a.m. Process C:\Program Files\Google\Google Desktop Search\GoogleDesktop.exe (PID 1540) tried to access Kaspersky Anti-Virus process (PID 2268), but the action has been blocked by the Self-Defense component. No action on your part is necessary.
Bueno estoy tranquilo que no han sido mayores cambios y que el sistema sigue estable admeas un reinicio no le cae mal.
Luego Comentar que el sistema de particionado..
-Grub fedora 11 en el arrranque
-SISTEMA OS en C:
-Datos en D:
Y el Server Symantec Ghost que me guarda las Imágenes de los discos te da la tranquilidad para trabajar..
Pero que es lo que hago hacer Query Me encanta OFFICE en la sección de Datos de Excel encontramos el Microsoft Query


El motivo de esta Entrada es que es divertido trabajar en Windows y más ahora con el boom del Windows 7 seria original ARMAR UN GRUPO DE REUNION para estar al día bueno es difícil por el tiempo. Pero ya aburren solo los “feed” RSS recomendados la subscriciones a los blog de seguridad las google alerts ..
Llegue al punto donde me preguntaron mira “quien es tu grupo” no tengo grupo asi que es fácil hacer uno solo se necesitan buscarlos..pero la humildad en buen punto.
La mayoría de grupo a que asistido son de SOFTWARE LIBRE pero existe cierto orgullo , estos grupos quieren ser elite la cosa esta en compartir conocimientos.
De un día a otro cambia todo...
un manejo de archivos y bloqueo de programas muy util es el squid aqui dejo algunos parametros
bloquear messenger
acl msnmime req_mime_type ^application/x-msn-messenger
acl msngw url_regex -i gateway.dll
http_access deny msnmime
http_access deny msngw
#Definir rango IP Local
acl LAN src 1xx.xx.x.x-1xx.xx.x.xxx/255.255.255.255
acl dbod src 1xx.xx.x.x
acl dfin src 1xx.xx.x.x
http_access deny dbod
http_access deny dfin
Concepto de acl
y por ultimo para administrar todo tenemos el webmin una pantalla
quien no quiere supervisar o reportar el acceso de inter por ususario.
No hay mejor software que ntop
[xcero@one ~]#yum install ntop[xcero@one ~]# ntop -i "eth0,eth1" -d -L -u ntop -P /var/ntop/ --skip-version-check --use-syslog=daemonBueno estos dias he pensado en publicar esto o aquello pero nunca , la razon es que he estado fuera de forma con linux me he estado dedicando a cosas como averiguar servicetag equipo dell de la compañia me encontre este script en vbs.
Te despliega en una ventana lo siguiente
On Error Resume Next do while strcomputer = "" and a < 2 strcomputer = Inputbox ("Introduce direccion IP o Nombre de Pc","Informacion Remota","IP") strcomputer = trim(strcomputer) a = a + 1 loop if not strComputer <> "" then wscript.echo "No computer name entered, ending script" wscript.quit end if On Error Resume Next Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\CIMV2") wscript.echo "You do not have sufficient access rights to this computer" wscript.quit else wscript.echo "Could not locate computer" &vbcrlf& "Please check IP Address/Computer Name and try again" wscript.quit end if end if Set colItems = objWMIService.ExecQuery("SELECT * FROM Win32_BIOS") Set colItems1 = objWMIService.ExecQuery("SELECT * FROM Win32_ComputerSystem") Set colItems2 = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration Where IPEnabled = True") Set colitems3 = objWMIService.ExecQuery("SELECT * FROM Win32_computersystem") Set colitems4 = objWMIService.ExecQuery("SELECT * FROM Win32_NetworkLoginProfile") Set colitems5 = objWMIService.ExecQuery("SELECT * FROM Win32_LogicalDisk Where DriveType = 3") Set objExplorer = CreateObject("InternetExplorer.Application") objExplorer.Navigate "about:blank" objExplorer.ToolBar = 0 objExplorer.StatusBar = 0 objExplorer.Width = 800 objExplorer.Height = 600 objExplorer.Left = 100 objExplorer.Top = 100 objExplorer.Visible = 1 Do While (objExplorer.Busy) Loop Set objDocument = objExplorer.Document objDocument.Open objDocument.Writeln "" objDocument.Writeln "" ' Computer Detals For Each objItem In colItems serial = objitem.serialnumber next For Each objItem In colItems1 hostname = objitem.caption make = objitem.manufacturer model = objitem.model next objDocument.Writeln "Computer Information For: " & Ucase(hostname) & "
" objDocument.Writeln "Serial : " & Serial & "
" objDocument.Writeln "Make : " & make & "
" objDocument.Writeln "Model : " & Model & "
" For Each objItem In colItems5 driveletter = objitem.name capacity = ((objitem.size / 1024) / 1024) / 1024 free = ((objitem.FreeSpace / 1024) / 1024) / 1024 free = FormatNumber (free,2) capacity = FormatNumber (capacity,2) objDocument.Writeln "Capacity of " &driveletter& " - " & capacity & "GB
" objDocument.Writeln "Free Space on " &driveletter& " - " & Free & "GB
" next objDocument.Writeln "
Please Wait, gathering more information...
" ' User Details For Each objItem In colItems3 loggedon = objitem.username next For Each objItem In colItems4 cachedlog = objitem.name username = objitem.FullName passwordexpire = objitem.passwordexpires badpassword = objitem.badpasswordcount if loggedon = cachedlog then objDocument.Writeln "User Information For...
" objDocument.Writeln "" & username & "
" objDocument.Writeln " User Name :" & loggedon &"
" objDocument.Writeln " Incorrect Password Attempts : " & badpassword &"
" on error resume next Set objaccount = GetObject("WinNT://**********/" &objitem.caption & ",user") objDocument.Writeln "unable to retrieve password expiration information
" Else If objAccount.PasswordExpired = 1 Then objDocument.Writeln "Password has Expired!
" Else objDocument.Writeln "Password Expires " & objAccount.PasswordExpirationDate & "
" end if end if end if next ' Network Adapter Details For Each objItem In colItems2 ipaddress = objitem.ipaddress(0) description = objitem.description DHCP = objitem.DHCPserver Domain = objitem.DNSdomain mac = objitem.MACaddress DNS = objitem.dnsserversearchorder(0) DNS1 = objitem.dnsserversearchorder(1) DNS2 = objitem.dnsserversearchorder(2) wins1 = objitem.winsprimaryserver wins2 = objitem.winssecondaryserver if not ipaddress = "0.0.0.0" then objDocument.Writeln "Network Adapter Details For...
" objDocument.Writeln "" & description & "
" objDocument.Writeln " IP Address :" & ipaddress &"
" objDocument.Writeln " DHCP Server : " & DHCP &"
" objDocument.Writeln " Domain Name : " & domain &"
" objDocument.Writeln " MAC Address : " & mac &"
" objDocument.Writeln " Primary DNS : " & DNS &"
" objDocument.Writeln " Secondary DNS : " & DNS1 &"
" objDocument.Writeln " Tertiary DNS : " & DNS2 &"
" objDocument.Writeln " Primary WINS : " & wins1 &"
" objDocument.Writeln " Secondary WINS : " & WINS2 &"
" end if next objDocument.Writeln "Script Finished
"
