PoshCode Logo PowerShell Code Repository

Difference between
modified post 6849 by 92ABAUTISTAW7 on Wed 19th Apr 19:18 and
original post 3786 by Pedro Genil on Mon 26th Nov 00:10
Showold version | new version | both versions

    
11
#Generamos los usuarios por buzon y comprimimos el resultado
22
#Autor: Pedro Genil
33
#Fecha: 2012/11/21
44
#Version: 1.0
55
66
If ((Get-PSSnapin | where {$_.Name -match "Exchange.Management"}) -eq $null)
77
{
88
	Add-PSSnapin Microsoft.Exchange.Management.PowerShell.Admin
99
}
1010
# Creamos el alias para el 7zip
1111
if (-not (test-path "$env:ProgramFiles\7-Zip\7z.exe")) {throw "$env:ProgramFiles\7-Zip\7z.exe needed"}
1212
set-alias sz "$env:ProgramFiles\7-Zip\7z.exe"
1313
#Directorios
1414
$filePath = 'F:\Scripts\users_Acount\'
1515
$fecha = get-date
1616
$fecha= $fecha.toString("yyyyMMdd")
1717
$filedate = $fecha
1818
$info = Get-Mailbox -resultsize unlimited -ignoredefaultscope |select database,displayname,samaccountname,PrimarySmtpAddress,EmailAddresses -expandproperty EmailAddresses | out-file F:\Scripts\users_Acount\$filedate.txt
1919
$files = Get-ChildItem -Recurse -Path $filePath | Where-Object { $_.name -eq "$fecha.txt" }
2121
#Cogemos el fichero , y creamos el zip
2222
sz a "F:\Scripts\users_Acount\$fecha.zip" "$filepath\$files"
2323
#Borramos el txt
2424
remove-item "F:\Scripts\users_Acount\$filedate.txt"
2525
#foreach ($file in $files)
2626
#{
2828
#                    $name = $file.name
2929
#                    $directory = $file.DirectoryName
3030
#                    sz a "F:\Scripts\users_Acount\$zipfile.zip" "$directory\$name"
3333
#}

ContributeMost Recent Contributions (feed)

Contribute ... Next Page