SCCM 2007 R2 – резервное копирование и восстановление
Алексей Тараненко
net start SMS_Site_Backup
-----------------------------------------------------------------------------------------------------------------
Проводим реализацию тонкого делегирования прав в Active Directory
Вадим Андросов
Листинг 1. Каркас hta-приложения
Move
Some caption
Some text
Const PREFERRED_WIDTH = 400
Const PREFERRED_HEIGHT = 300
function window_onLoad()
dim x, y, w, h, scrW, scrH
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_DesktopMonitor")
For Each objItem in colItems
scrW = objItem.screenWidth
scrH = objItem.screenHeight
exit for
next
w = PREFERRED_WIDTH
h = PREFERRED_HEIGHT
x = (scrW - PREFERRED_WIDTH) / 2
y = (scrH - PREFERRED_HEIGHT) / 2
if scrW < PREFERRED_WIDTH then
w = scrW
x = 0
end if
if scrH < PREFERRED_HEIGHT then
h = scrH
y = 0
end if
window.moveTo x, y
window.resizeTo w, h
end function
Листинг 2. Пользовательский интерфейс, созданный с помощью HTML
dim curPath, backPath, prevPath, user, engine
Листинг 3. Функция инициализации приложения
function window_onLoad()
set engine = createObject("UserMove.Engine")
startMove.ouList.focus
set user = getObject(extractArg)
userToMove.innerhtml = "" & user.cn & ""
setCurPath(engine.getParent(user.distinguishedName))
end function
"\\marklar.ua\UserMoveSupport\exec\enqueue.hta" "LDAP://main.marklar.ua/cn=Gomer J. Simpson, OU=South Park,DC=marklar,DC=ua" user
".+" "?([^"]+)"? .+
function extractArg
dim re, aMatch, q
set re = new Regexp
re.pattern = _
replace("'.+' '?([^']+)'? .+", "'", chr(34))
re.ignoreCase = True
set aMatch = re.execute(app.commandline)
if aMatch.count > 0 then
if aMatch(0).subMatches.count > 0 then
extractArg = aMatch(0).subMatches(0)
re.pattern = "\/\/[^\/]*/"
extractArg = re.replace(extractArg, "//")
end if
end if
end function
sub populateList
startMove.ouList.options.length = 0
startMove.ouList.add newOption("< . .", backPath)
startMove.ouList.add newOption("> <", "")
dim curOU, subOU
set curOU = getObject(curPath)
for each subOU in curOU
if subOU.class = "organizationalUnit" then startMove.ouList.add newOption(subOU.ou, subOu.ADSPath)
end if
next
dim selectIt, opt
selectIt = 0
for each opt in startMove.ouList.options
if opt.value = prevPath then selectIt = opt.index
next
startMove.ouList.selectedIndex = selectIt
end sub
Листинг 4. Создание нового элемента списка
function newOption(oText, oValue)
set newOption = document.createElement("option")
newOption.value = oValue
newOption.text = oText
end function
Листинг 5. Обработка события выбора элемента списка
function itemSelected()
dim newPath
newPath = startMove.ouList.value
if newPath <> "" then
setCurPath(newPath)
else
moveUserTo
end if
end function
Листинг 6. Переход в заданную организационную единицу
sub setCurPath(path)
if not isEmpty(curPath) then
prevPath = curPath
else
prevPath = path
end if
curPathShow.innerhtml = engine.ADSPath2Readable(path)
curPath = path
backPath = engine.getParent(path)
populateList
end sub
Листинг 7. Обработка нажатий клавиш
function onKey()
select case window.event.keyCode
case 13: itemSelected
case 8: setCurPath(backPath)
end select
end function
function moveUserTo()
dim comment, ans
ans = msgbox("Moving " & user.cn & " to " & vbLF & engine.ADSPath2Readable(curPath), vbOKCancel + vbQuestion)
if ans = vbCancel then exit function
comment = inputBox("Post your comment here")
msgbox engine.move(user.ADSPath, curPath, comment)
window.close
end function
sub populateList
viewOut.outcomingList.options.length = 0
ou.filter = Array("userMoveWaitingRoom")
dim room, roomFound
roomFound = false
for each room in ou
roomFound = true
exit for
next
if not roomFound then exit sub
room.filter = Array("userMoveChairLink")
dim li, user, commanded, cmd
for each li in room
set user = getObject(li.userMoveLink)
ou.filter = Array("UserMoveCommand")
commanded = false
for each cmd in ou
if cmd.userMoveTarget = user.ADSPath then
commanded = true
exit for
end if
next
if not commanded then
viewOut.outcomingList.add newOption(user.cn, li.userMoveLink)
end if
next
viewOut.iDest.value = ""
viewOut.iTime.value = ""
viewOut.iMover.value = ""
viewOut.iComment.value = ""
end sub
Листинг 8. Инициализация приложения отмены перемещения
function window_onLoad()
set engine = createObject("UserMove.Engine")
viewOut.outcomingList.focus
set ou = getObject(extractArg)
ouName.innerhtml = "" & ou.ou & ""
populateList
end function
function selChanged()
dim chair, s, mover, moverCN
set chair = getObject(engine.getParent(viewOut.outcomingList.value))
viewOut.iDest.value = engine.ADSPath2Readable(engine.getParent(chair.parent))
viewOut.iTime.value = engine.fromUTC(CDate(chair.userMoveWhen))
viewOut.iComment.value = chair.userMoveComment
on error resume next
set mover = getObject(chair.userMoveWho)
on error goto 0
viewOut.iMover.value = moverCN
end function
function doRollBack()
dim userPath, ans
userPath = viewOut.outcomingList.value
if userPath = "" then
MsgBox "Nothing is selected"
Else
ans = msgbox("Do you want to rollback the transfer?", vbYesNo + vbQuestion)
if ans = vbNo then exit function
MsgBox engine.rollback(userPath)
end if
populateList
end function
sub populateList
room.filter = Array("UserMoveChair")
dim ch, user, cmd, commanded
for each ch in room
for each user in ch
exit for
next
end sub
Листинг 9. Функция подтверждения перемещения выбранного пользователя
function doAccept()
dim userPath, ans
userPath = viewOut.incomingList.value
if userPath = "" then
MsgBox "Nothing is selected"
else
ans = msgbox("Do you want to accept the transfer?", vbYesNo + vbQuestion)
if ans = vbNo then exit function
MsgBox engine.accept(userPath)
end if
populateList
end function
-----------------------------------------------------------------------------------------------------------------
Осваиваем нововведения языка сценариев Windows PowerShell 2.0
Василий Гусев
start /w ocsetup MicrosoftWindowsPowerShell
help about_remoting
PS C:\> $Comps = Get-Content Computers.txt
PS C:\> $Job = Get-WmiObject Win32_ComputerSystem `
PS C:\> $job.ChildJobs
$type = Add-Type @"
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
"@ -name "Win32ShowWindowAsync" -namespace Win32Functions -passthru
#Скрывает окно PowerShell
$type::ShowWindowAsync((get-process -id $pid).MainWindowHandle,2)
#Снова показывает окно
$type::ShowWindowAsync((get-process -id $pid).MainWindowHandle,10)
$Provider = Get-WinEvent -ListProvider *update*
$Provider.Events | Format-Table Id, description -AutoSize
Get-Help Get-WinEvent -Examples
Help ИмяКомандлета
Get-Help "regular expression"
Get-Content Log.txt | select-string "Error" -Context 1,2
-----------------------------------------------------------------------------------------------------------------
FreeBSD tips: periodic на службе сисадмина
Сергей Супрунов
$ grep periodic /etc/crontab
daily_output="admin"
weekly_output="amsand@rambler.ru"
monthly_output="/var/log/monthly.log"
myscripts_output=""
daily_clean_preserve_enable="NO"
daily_clean_msgs_enable="NO"
daily_clean_rwho_enable="NO"
daily_accounting_enable="NO"
daily_news_expire_enable="NO"
daily_status_rwho_enable="NO"
daily_status_disks_df_flags="-l -h -i"
weekly_locate_enable="NO"
weekly_whatis_enable="NO"
weekly_noid_enable="YES"
weekly_status_pkg_enable="YES"
-----------------------------------------------------------------------------------------------------------------
WebVPN на базе Сisco IOS
Иван Панин
! Задействуем модель контроля доступа AAA
aaa new-model
! Создаем учетную запись пользователя в локальной базе
! данных, также можно использовать внешнюю аутентификацию,
! например, TACACS- или RADIUS-сервер
username user01 privilege 0 secret 0 cisco221
! Задействуем аутентификацию для локальных пользователей
aaa authentication login default local
! DNS-настройки для WebVPN-шлюза: имя хоста, домен
! и сервер имен
hostname router01
ip domain name company.ru
ip name server 192.168.1.3
! Обьявляем удостоверяющий центр
! (Certification Authority, CA)
crypto pki trustpoint router01.company.ru
! Подписываем
enrollment selfsigned
! Общая информация, главное здесь – каноническое имя:
! CN, совпадающее с записью А на DNS-сервере
subject-name cn=router01.company.ru,o=JSCCompany,c=RU,st=AltayTerritory
rsakeypair router01.company.ru
! Генерируем сертификат
crypto pki enroll router01.company.ru
#show crypto pki certificates
ip local pool ssl-vpn-client-dynpool 10.10.1.5 10.10.1.20
webvpn gateway WebVPNGateway
hostname router01
ip address 172.16.1.1 port 443
http-redirect port 80
ssl trustpoint router01.company.ru
! Определяем алгоритм шифрования для SSL-протокола,
! также доступны aes-sha1 и rc4-md5
ssl encryption 3des-sha1
! Ведение журнала ошибок и событий
logging enable
! Задействуем WebVPN-шлюз
inservice
webvpn install svc flash:/anyconnect-win-2.x.pkg sequence 1
webvpn install svc flash:/anyconnect-macosx-i386-2.x.pkg sequence 2
! Клиент для Windows CE, подходит для Mobile, т.к. они основаны на CE
webvpn install svc flash:/anyconnect-wince-ARMv4I-2.x.pkg sequence 3
webvpn install svc flash:/anyconnect-linux-2.x-k9.pkg sequence 4
webvpn install csd flash:/securedesktop-ios-3.x-k9.pkg
! После в конфигурации появятся строки:
webvpn install svc flash:/webvpn/svc_1.pkg sequence 1
webvpn install svc flash:/webvpn/svc_2.pkg sequence 2
webvpn install svc flash:/webvpn/svc_3.pkg sequence 3
webvpn install svc flash:/webvpn/svc_4.pkg sequence 4
webvpn install csd flash:/webvpn/sdesktop.pkg
! Для быстрой коммутации IP-пакетов необходимо включить
! Сisco Express Forwarding (CEF)
webvpn cef
webvpn context SSLVPN
! Заголовок и сообщение на странице аутентификации
! портала, оформление
title "Router01 Web-VPN page Welcome!"
title-color #CCCC66
secondary-color white
text-color black
logo file flash:/company.gif
login-message "Please enter your credentials.."
! Ограничение на число одновременных WebVPN-сессий
max-users 150
! Режим проверки сертификата
ssl authenticate verify all
! Здесь можно задействовать Cisco Security Desktop
csd enable
url-list "Links"
heading "QuickLinks"
url-text "WebMail" url-value "mail.company.ru"
url-text "SharePoint" url-value "wss.company.ru"
url-text "CRM" url-value "crm.company.ru"
nbns-list "NBNS-Servers"
nbns-server 192.168.1.4 master
nbns-server 192.168.1.5 timeout 10 retries 5
cifs-url-list CIFS-List
heading Share-list
url-text "Public_on_Server01" url-value \\server01\public
url-text "Sales_on_Server01" url-value \\server01\sales
port-forward "Portlist"
local-port 30025 remote-server "192.168.1.2" remote-port 25 description "SMTP"
local-port 30143 remote-server "192.168.1.2" remote-port 143 description "IMAP"
local-port 30022 remote-server "192.168.1.3" remote-port 3389 description "RDP"
policy group SSL-Policy
! Ассоциируем созданный ранее набор ссылок «Links»
! с групповой политикой
url-list "Links"
! Кнопка для запуска тонкого клиента (в портале), также
! можно настроить автозапуск Java-апплета сразу после
! успешной аутентификации путем добавления ключа
! auto-download
port-forward "Portlist"
! Разрешаем доступ к списку файловых серверов с указанием
! прав доступа
nbns-list "NBNS-Servers"
functions file-access
functions file-browse
functions file-entry
! Ассоциируем созданный ранее набор ссылок сетевых папок
! «CIFS-List» с групповой политикой
cifs-url-lis "CIFS-List"
! Кнопка туннеля (в портале)
functions svc-enabled
! Сообщение после успешной аутентификации на портале
banner "JSC Company, support: "
! Простой и продолжительность сессии в секундах
timeout idle 1800
timeout session 36000
! Сетевые настройки для VPN-клиентов
svc address-pool "ssl-vpn-client-group-dynpool"
svc default-domain "company.ru"
svc dns-server primary 192.168.1.4
svc wins-server primary 192.168.1.4
svc default-domain company.ru
! Сохраняем установленный SVC-клиент на компьютере
! пользователя, в противном случае после завершения
! сеанса будет автоматически деинсталлирован
svc keep-client-installed
default-group-policy SSL-Policy
! Ассоциация шлюза с контекстом
gateway WebVPNGateway
! Задействуем конфигурацию контекста
inservice
#sh webvpn context
#sh webvpn gateway
-----------------------------------------------------------------------------------------------------------------
Ускоряем загрузку сайта, минимизируя количество HTTP-запросов
Антон Гришан
…
…
.w10, .w11, .w20, .w21, .w24, .wci, .wpb {
background:transparent url(/images/nav_logo4.png) no-repeat scroll 0 0;
border:0 none;
cursor:pointer;
height:16px;
margin-left:8px;
vertical-align:bottom;
width:16px;
}
.w20, .w21 {
margin-left:3px;
}
.w20 {
background-position:-152px -32px;
}
.test {background:url(icon.png);}
data:[][;charset=""][;base64],
.test {
background:url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQAQMAAAAlPW0iAAAABlBMVEUAAAD///+l2Z/dAAAAM0lEQVR4nGP4/5/h/1+G/58ZDrAz3D/McH8yw83NDDeNGe4Ug9C9zwz3gVLMDA/A6P9/AFGGFyjOXZtQAAAAAElFTkSuQmCC);
}
';
}
function convertImgToDataUrlFormat($imgFilePath, $mimeType) {
$contents = file_get_contents($imgFilePath);
$base64 = base64_encode($contents);
return ('data:' . $mimeType . ';base64,' . $base64);
}
?>
=getFaviconHtml('favicon.ico')?>
Favicon with data:URL
HELLO data:URL
FileETag None
Header unset Last-Modified
Header set Expires "Thu, 15 Apr 2030 20:00:00 GMT"
www.domain.tld/res/img/logo.png?etag=342345334
www.domain.tld/res/img/map.png?etag=983234521
class View {
const resVersion = '04';
public static function includeImg($fileName) {
return '/res'.self::resVersion.'/img/'.$fileName;
}
}
echo '';
?>
Test cache system
Try to load some
Load some imgs, load some aditional CSS and JS code