In Run command line task put:
cmd.exe /c diskpart /s "%scriptroot%\changepart.txt"
Then in \Deploymentshare\Scripts folder create changepart.txt file and type into it something like:
select disk 1
online disk noerr
attributes disk clear readonly noerr
select volume 0
assign letter=F noerr
select volume 2
assign letter=D noerr
exit
I write some useful information and lessons learnt about SCCM, MDT, SCOM, Exchange, Lync, Windows 7/8, Windows servers, Hyper-V, Vmware
Szukaj na tym blogu
poniedziałek, 9 grudnia 2013
piątek, 6 grudnia 2013
MDT asking for product key during deployment
If You are using Windows installation files from OEM dvd MDT will ask You for product key during deployment even if You specify SkipProductKey=YES
To prevent it copy product key from product.ini file from dvd sources catalog and put it in unattend.xml for specific task sequence
To prevent it copy product key from product.ini file from dvd sources catalog and put it in unattend.xml for specific task sequence
MDT format just first partition
If You want format only first partition during deployment task sequence just disable Format and Partition task. The setup will carry out formatting first partition
piątek, 15 listopada 2013
piątek, 2 sierpnia 2013
Windows 7 KIOSK mode configuration
A kiosk
machine is a very locked down PC that allows to perform one simple task, such
as running one application, or browsing to one, or a limited set of websites.
Windows
itself only requires basic configuration and some group policy changes. We haven't joined these machines to
domain, so group policy changes were done locally by local GPO described below. We made all the obvious changes, like
disabling screensavers, power saving.
After
deployment of OS using MDT task sequence and manually restarting PC Your
receive only Internet Explorer
There is no
possibility that user will close this application or run another.
Users also cannot logoff or shutdown PC. Using specified key combination You can display command line – this keyboard shortcut
should not be reveled for users. Task manager is blocked but You can run Process Explorer from cmd – it is in
C:\windows\procexp.exe
Users should
be automatically login with standard user – to do this use
autologon.exe from c:\windows, e.g:
autologon.exe suser “” password
then reboot
autologon.exe suser “” password
then reboot
GPO details:
To display only Internet explorer and Chrome:
User
Configuration > Administrative Templates > System > Custom user
interface
and set it:
“c:\windows\kiosk.exe”
To disable Task manager (CTRL+ALT-DEL) configure GPO:
Configure
User Configuration >Policies >Administrative Templates >System >Ctrl+Alt+Del
Option >Remove Task Manager >EnableConfigure Computer Configuration >Policies >Administrative Templates >System >Group Policy >User Group Policy loopback processing mode >Enable >Mode: Merge
Power button settings:
Computer
Configuration > Policies > Administrative Templates > System > Power
Management > Button Settings
Power management:
Computer
Settings > Administrative Templates > System > Power Management >
Sleep settings
Custom user interface
(shell)
We created
custom user interface (shell) using AutoHotKey application. We wrote some macro
which control all keyboard shortcuts like CTRL+ESC or CRTL+F4. Below is a
listening of this macro:
Run
"%ProgramFiles%\Internet Explorer\iexplore.exe"
;
Custom Hotkeys
;
;
;
;
;
Block System Specific Keys
;!Tab::return
; Alt+Tab to change Windows
!F4::return
; Alt+F4 to close Windows
LWin::return
; Left Windows Key
RWin::return
; Right Windows Key
^Esc::return
; Task Manager
RButton::Return
MButton::Return
^MButton::Return
!MButton::Return
+MButton::Return
^RButton::Return
!RButton::Return
+RButton::Return
^LButton::Return
!LButton::Return
+LButton::Return
^J::Return
^H::Return
^W::Return
^G::Return
^S::Return
^B::Return
^I::Return
+F10::Return
^+Delete::Return
^!Delete::Return
^NumpadAdd::Return
^NumpadSub::Return
^=::Return
^-::Return
^WheelUp::Return
^WheelDown::Return
; Set
the following to only work against Internet Explorer
#IfWinActive
ahk_class IEFrame
;
Block IE Specific Ctrl+Key sequences
^T::return
; New Tab
^K::return
; Duplicate Tab
^N::return
; New Windows
;^O::return
; Open File/Location
^S::return
; Save As
^W::return
; Close Tab
^P::return
; Print
^J::return
; Downloads
^I::return
; Favorites
^H::return
; History
^G::return
; Feeds
F1::return
; Help
F12::return
; Developers Console
^+I::return
; Favorites
^+H::return
; History
^+G::return
; Feeds
^+P::return
; InPrivate Browsing
#IfWinActive
; End the WinActive command
|
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer]
[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Internet Explorer\Restrictions]
"NoBrowserOptions"=dword:00000001
"NoBrowserClose"=dword:00000001
"NoFileOpen"=dword:00000001
"NoOpenInNewWnd"=dword:00000000
Black screen after Windows 7 deployment
This can happen when You use some Windows 7 image with default administrator account name changed (e.g. admin). Then When you sysprep and capture such image and try to deploy black screen will appear just after deployment, before logon screen. The resolution in this situation is to put
true
section into unattend.xml file used for deployment
section into unattend.xml file used for deployment
poniedziałek, 27 maja 2013
Set regional options using script
tzutil /s "Central European Standard Time"
xcopy pl.xml c:\windows
control.exe intl.cpl,,/f:"c:\windows\pl.xml"
And pl.xml contains:
xcopy pl.xml c:\windows
control.exe intl.cpl,,/f:"c:\windows\pl.xml"
And pl.xml contains:
Disable Windows 7 features for hardening
DismRemoveFeatures.bat which contains:
dism
/online /disable-feature /featurename:TabletPCOC /NoRestart
dism
/online /disable-feature /featurename:MediaPlayback /NoRestart
dism
/online /disable-feature /featurename:WindowsMediaPlayer /NoRestart
dism
/online /disable-feature /featurename:MediaCenter /NoRestart
dism
/online /disable-feature /featurename:OpticalMediaDisc /NoRestart
dism
/online /disable-feature /featurename:SearchEngine-Client-Package /norestart
dism
/online /disable-feature /featurename:Printing-XPSServices-Features /norestart
dism
/online /disable-feature /featurename:Internet-Explorer-Optional-x86 /norestart
dism /online
/disable-feature /featurename:Internet-Explorer-Optional-amd64 /norestart
dism
/online /disable-feature /featurename:Xps-Foundation-Xps-Viewer /norestart
Set black wallpaper
wallpaper.bat
which contains:
xcopy
black.bmp c:\windows\web\wallpaper\
regedit
/s wallpaper.reg
wallpaper.reg
contains:
Windows
Registry Editor Version 5.00
[HKEY_CURRENT_USER\Control
Panel\Desktop]
"Wallpaper"="c:\\windows\\web\\wallpaper\\black.bmp"
And black.bmp is one black pixel image
Remove Default Application from Windows
takeown /F "C:\Program Files\Windows NT\Accessories\wordpad.exe"
echo y| cacls "C:\Program Files\Windows NT\Accessories\wordpad.exe" /G administrator:F
del "C:\Program Files\Windows NT\Accessories\wordpad.exe" /Q /F
echo y| cacls "C:\Program Files\Windows NT\Accessories\wordpad.exe" /G administrator:F
del "C:\Program Files\Windows NT\Accessories\wordpad.exe" /Q /F
Disable some devices in Device manager using script - devcon
devcon.bat which contains:
if /i
"%PROCESSOR_ARCHITECTURE%" EQU "x86" (
xcopy .\i386\devcon.exe c:\windows\system32
/Y
start /b /wait devcon.exe disable
IDE\CDROM*
start /b /wait devcon.exe disable HDAudio*
start /b /wait devcon.exe disable
ACPI\PNP0501\0
goto Done
)
if /i
"%PROCESSOR_ARCHITECTURE%" EQU "AMD64" (
xcopy .\amd64\devcon.exe
c:\windows\system32 /Y
start /b /wait devcon.exe disable
IDE\CDROM*
start /b /wait devcon.exe disable HDAudio*
start /b /wait devcon.exe disable
ACPI\PNP0501\0
goto Done
)
:Done
timeout 5
Sql Express 2008 R2 x64 silent install
SQLEXPR_x64_ENU.EXE
/ConfigurationFile=\Options\ConfigurationFile.ini
Content of ConfigurationFile.ini
;SQLSERVER2008 Configuration File
[SQLSERVER2008]
IACCEPTSQLSERVERLICENSETERMS=1
; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will reflect the instance ID of the SQL Server instance.
INSTANCEID="MultiTrans"
; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter.
ACTION="Install"
; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, and Tools. The SQL feature will install the database engine, replication, and full-text. The Tools feature will install Management Tools, Books online, Business Intelligence Development Studio, and other shared components.
FEATURES=SQLENGINE,REPLICATION,SNAC_SDK
; Displays the command line parameters usage
HELP="False"
; Specifies that the detailed Setup log should be piped to the console.
INDICATEPROGRESS="True"
; Setup will not display any user interface.
QUIET="False"
; Setup will display progress only without any user interaction.
QUIETSIMPLE="True"
; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.
X86="False"
; Detailed help for command line argument ROLE has not been defined yet.
ROLE="AllFeatures_WithDefaults"
; Detailed help for command line argument ENU has not been defined yet.
ENU="True"
; The directory for the extracted service pack files used to update the setup media.
;PCUSOURCE="c:\7141bc839566ce454173\PCUSOURCE"
; Parameter that controls the user interface behavior. Valid values are Normal for the full UI, and AutoAdvance for a simplied UI.
; UIMODE="Normal"
; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature.
ERRORREPORTING="False"
; Specify the root installation directory for native shared components.
INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server"
; Specify the root installation directory for the WOW64 shared components.
INSTALLSHAREDWOWDIR="C:\Program Files (x86)\Microsoft SQL Server"
; Specify the installation directory.
INSTANCEDIR="C:\Program Files\Microsoft SQL Server"
; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature.
SQMREPORTING="False"
; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS).
INSTANCENAME="MULTITRANS"
; Agent account name
AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"
; Auto-start service after installation.
AGTSVCSTARTUPTYPE="Disabled"
; Startup type for Integration Services.
ISSVCSTARTUPTYPE="Automatic"
; Account for Integration Services: Domain\User or system account.
ISSVCACCOUNT="NT AUTHORITY\NetworkService"
; Controls the service startup type setting after the service has been created.
ASSVCSTARTUPTYPE="Automatic"
; The collation to be used by Analysis Services.
ASCOLLATION="Latin1_General_CI_AS"
; The location for the Analysis Services data files.
ASDATADIR="Data"
; The location for the Analysis Services log files.
ASLOGDIR="Log"
; The location for the Analysis Services backup files.
ASBACKUPDIR="Backup"
; The location for the Analysis Services temporary files.
ASTEMPDIR="Temp"
; The location for the Analysis Services configuration files.
ASCONFIGDIR="Config"
; Specifies whether or not the MSOLAP provider is allowed to run in process.
ASPROVIDERMSOLAP="1"
; A port number used to connect to the SharePoint Central Administration web application.
FARMADMINPORT="0"
; Startup type for the SQL Server service.
SQLSVCSTARTUPTYPE="Automatic"
; Level to enable FILESTREAM feature at (0, 1, 2 or 3).
FILESTREAMLEVEL="0"
; Set to "1" to enable RANU for SQL Server Express.
ENABLERANU="True"
; Specifies a Windows collation or an SQL collation to use for the Database Engine.
SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS"
; Account for SQL Server service: Domain\User or system account.
SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"
; Windows account(s) to provision as SQL Server system administrators.
;SQLSYSADMINACCOUNTS="%computername%\admin"
; Provision current user as a Database Engine system administrator for SQL Server 2008 R2 Express.
ADDCURRENTUSERASSQLADMIN="True"
; Specify 0 to disable or 1 to enable the TCP/IP protocol.
TCPENABLED="0"
; Specify 0 to disable or 1 to enable the Named Pipes protocol.
NPENABLED="0"
; Startup type for Browser Service.
BROWSERSVCSTARTUPTYPE="Disabled"
; Specifies which account the report server NT service should execute under. When omitted or when the value is empty string, the default built-in account for the current operating system.
; The username part of RSSVCACCOUNT is a maximum of 20 characters long and
; The domain part of RSSVCACCOUNT is a maximum of 254 characters long.
RSSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"
; Specifies how the startup mode of the report server NT service. When
; Manual - Service startup is manual mode (default).
; Automatic - Service startup is automatic mode.
; Disabled - Service is disabled
RSSVCSTARTUPTYPE="Automatic"
; Specifies which mode report server is installed in.
; Default value: “FilesOnly”
RSINSTALLMODE="FilesOnlyMode"
Sql Express 2008 R2 x86 silent install
SQLEXPR32_x86_ENU.EXE
/ConfigurationFile=\Options\ConfigurationFile.ini
Content of ConfigurationFile.ini
;SQLSERVER2008 Configuration File
[SQLSERVER2008]
IACCEPTSQLSERVERLICENSETERMS=1
; Specify the Instance ID for the SQL Server features you have specified. SQL Server directory structure, registry structure, and service names will reflect the instance ID of the SQL Server instance.
INSTANCEID="MultiTrans"
; Specifies a Setup work flow, like INSTALL, UNINSTALL, or UPGRADE. This is a required parameter.
ACTION="Install"
; Specifies features to install, uninstall, or upgrade. The list of top-level features include SQL, AS, RS, IS, and Tools. The SQL feature will install the database engine, replication, and full-text. The Tools feature will install Management Tools, Books online, Business Intelligence Development Studio, and other shared components.
FEATURES=SQLENGINE,REPLICATION,SNAC_SDK
; Displays the command line parameters usage
HELP="False"
; Specifies that the detailed Setup log should be piped to the console.
INDICATEPROGRESS="True"
; Setup will not display any user interface.
QUIET="False"
; Setup will display progress only without any user interaction.
QUIETSIMPLE="True"
; Specifies that Setup should install into WOW64. This command line argument is not supported on an IA64 or a 32-bit system.
X86="False"
; Detailed help for command line argument ROLE has not been defined yet.
ROLE="AllFeatures_WithDefaults"
; Detailed help for command line argument ENU has not been defined yet.
ENU="True"
; The directory for the extracted service pack files used to update the setup media.
;PCUSOURCE="c:\75e047c441d47d38861e82d486c1\PCUSOURCE"
; Parameter that controls the user interface behavior. Valid values are Normal for the full UI, and AutoAdvance for a simplied UI.
;UIMODE="Normal"
; Specify if errors can be reported to Microsoft to improve future SQL Server releases. Specify 1 or True to enable and 0 or False to disable this feature.
ERRORREPORTING="False"
; Specify the root installation directory for native shared components.
INSTALLSHAREDDIR="C:\Program Files\Microsoft SQL Server"
; Specify the installation directory.
INSTANCEDIR="C:\Program Files\Microsoft SQL Server"
; Specify that SQL Server feature usage data can be collected and sent to Microsoft. Specify 1 or True to enable and 0 or False to disable this feature.
SQMREPORTING="False"
; Specify a default or named instance. MSSQLSERVER is the default instance for non-Express editions and SQLExpress for Express editions. This parameter is required when installing the SQL Server Database Engine (SQL), Analysis Services (AS), or Reporting Services (RS).
INSTANCENAME="MULTITRANS"
; Agent account name
AGTSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"
; Auto-start service after installation.
AGTSVCSTARTUPTYPE="Disabled"
; Startup type for Integration Services.
ISSVCSTARTUPTYPE="Automatic"
; Account for Integration Services: Domain\User or system account.
ISSVCACCOUNT="NT AUTHORITY\NetworkService"
; Controls the service startup type setting after the service has been created.
ASSVCSTARTUPTYPE="Automatic"
; The collation to be used by Analysis Services.
ASCOLLATION="Latin1_General_CI_AS"
; The location for the Analysis Services data files.
ASDATADIR="Data"
; The location for the Analysis Services log files.
ASLOGDIR="Log"
; The location for the Analysis Services backup files.
ASBACKUPDIR="Backup"
; The location for the Analysis Services temporary files.
ASTEMPDIR="Temp"
; The location for the Analysis Services configuration files.
ASCONFIGDIR="Config"
; Specifies whether or not the MSOLAP provider is allowed to run in process.
ASPROVIDERMSOLAP="1"
; A port number used to connect to the SharePoint Central Administration web application.
FARMADMINPORT="0"
; Startup type for the SQL Server service.
SQLSVCSTARTUPTYPE="Automatic"
; Level to enable FILESTREAM feature at (0, 1, 2 or 3).
FILESTREAMLEVEL="0"
; Set to "1" to enable RANU for SQL Server Express.
ENABLERANU="True"
; Specifies a Windows collation or an SQL collation to use for the Database Engine.
SQLCOLLATION="SQL_Latin1_General_CP1_CI_AS"
; Account for SQL Server service: Domain\User or system account.
SQLSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"
; Windows account(s) to provision as SQL Server system administrators.
;SQLSYSADMINACCOUNTS="MININT-GD3RQAC\admin"
; Provision current user as a Database Engine system administrator for SQL Server 2008 R2 Express.
ADDCURRENTUSERASSQLADMIN="True"
; Specify 0 to disable or 1 to enable the TCP/IP protocol.
TCPENABLED="0"
; Specify 0 to disable or 1 to enable the Named Pipes protocol.
NPENABLED="0"
; Startup type for Browser Service.
BROWSERSVCSTARTUPTYPE="Disabled"
; Specifies which account the report server NT service should execute under. When omitted or when the value is empty string, the default built-in account for the current operating system.
; The username part of RSSVCACCOUNT is a maximum of 20 characters long and
; The domain part of RSSVCACCOUNT is a maximum of 254 characters long.
RSSVCACCOUNT="NT AUTHORITY\NETWORK SERVICE"
; Specifies how the startup mode of the report server NT service. When
; Manual - Service startup is manual mode (default).
; Automatic - Service startup is automatic mode.
; Disabled - Service is disabled
RSSVCSTARTUPTYPE="Automatic"
; Specifies which mode report server is installed in.
; Default value: “FilesOnly”
RSINSTALLMODE="FilesOnlyMode"
Rename Administator Account using wmi
RenameAdministatorAccount
wmic
useraccount where name='Administrator' call rename name='admin'
Unpin shortcuts from Taskbar
Place this script in "C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup"
Script:
On Error
Resume Next
Set
objShell = CreateObject("Shell.Application")
Set
objFSO = CreateObject("Scripting.FileSystemObject")
Set
strLNKFilePath =
objShell.NameSpace("C:\Options\GoogleChrome\32")
strLnkFile =
strLNKFilePath.Self.Path & "\Gmail.lnk"
Set GmailItems = strLNKFilePath.Items()
For Each Item in GmailItems
If (Item.Name =
"Gmail") Then
For Each Verb
in Item.Verbs
If
(Verb.Name = "Unpin from Tas&kbar") Then Verb.DoIt
Next
End If
Next
czwartek, 9 maja 2013
czwartek, 11 kwietnia 2013
Windows PE iso using ADK
Copype amd64 C:\winpe_amd64Makewinpemedia /iso C:\winpe_amd64 C:\winpe_amd64\winpe_amd64.iso
środa, 3 kwietnia 2013
Zamiana ciągów znaków w wielu plikach
$file = Get-ChildItem -Include unattend.xml -Recurse
Foreach ($str in $file)
{
$cont = Get-Content $str
$cont | Foreach {$_ -replace "999", "2"} | Set-Content $str
$cont = Get-Content $str
$cont | Foreach {$_ -replace "P@ssw0rd ", "newP@ssw0rd "} | Set-Content $str
$exists = Select-String -Path $str -pattern "CopyProfile"
If ($exists -ne $null)
{
}
else
{
$cont = Get-Content $str
$cont | Foreach {$_ -replace "
", "`r`ntrue "} | Set-Content $str
}
}
Foreach ($str in $file)
{
$cont = Get-Content $str
$cont | Foreach {$_ -replace "999", "2"} | Set-Content $str
$cont = Get-Content $str
$cont | Foreach {$_ -replace "
$exists = Select-String -Path $str -pattern "CopyProfile"
If ($exists -ne $null)
{
}
else
{
$cont = Get-Content $str
$cont | Foreach {$_ -replace "
", "`r`n
}
}
czwartek, 28 lutego 2013
Troubleshooting svchost.exe
tasklist /SVC /FI "IMAGENAME eq svchost.exe"
http://blogs.technet.com/b/askperf/archive/2008/01/11/getting-started-with-svchost-exe-troubleshooting.aspx
http://blogs.technet.com/b/askperf/archive/2008/01/11/getting-started-with-svchost-exe-troubleshooting.aspx
Sprawdzenie jaka usługa wykorzystuje dany port
netstat.exe –a –n –o | findstr
Znajdź PID z ostatniej kolumny
tasklist /svc /FI "PID eq"
Znajdź PID z ostatniej kolumny
tasklist /svc /FI "PID eq
poniedziałek, 11 lutego 2013
Tworzenie skrzynek mailowych na Exchange w PowerShell
W Exchange Management Shell:
new-aduser -Name "Bartlomiej Belko" -GivenName "Bartlomiej" -surname "Belko" -SamAccountName "Bartlomiej.Belko" -UserPrincipalName "Bartlomiej.Belko@capgem.pl" -ChangePasswordAtLogon $false -DisplayName "Bartlomiej Belko" -Enabled $true -path "OU=Users,OU=LabTeam,DC=capgem,DC=pl" -AccountPassword (ConvertTo-SecureString -AsPlainText "P@ssw0rd" -Force) -Manager "CN=Jacek Stochlinski,OU=Users,OU=LabTeam,DC=capgem,DC=pl" -PasswordNeverExpires $true -server p-dc-01.capgem.pl
Enable-Mailbox -Identity capgem.pl\Bartlomiej.Belko -Alias Bartlomiej.Belko
W Lync Management Shell:
Get-CsAdUser -Identity "Bartlomiej Belko" | Enable-CsUser -RegistrarPool pool.capgem.pl -SipAddressType emailaddress -SipDomain capgem.pl
Set-CsUser -Identity "Bartlomiej Belko" -EnterpriseVoiceEnabled $true -LineURI TEL:6014
Set-CsClientPin -Identity capgem.pl\Bartlomiej.Belko -Pin 223344
W Exchange Management Shell:
Enable-UMMailbox -Identity capgem.pl\Bartlomiej.Belko -UMMailboxPolicy "Capgem Default Policy" -Pin 223344 -PinExpired $false
Tworzenie kont użytkowników w PowerShell
new-aduser -Name "Bartlomiej Belko" -GivenName "Bartlomiej" -surname "Belko" -SamAccountName "Bartlomiej.Belko" -UserPrincipalName "Bartlomiej.Belko@capgem.pl" -ChangePasswordAtLogon $false -DisplayName "Bartlomiej Belko" -Enabled $true -path "OU=Users,OU=LabTeam,DC=capgem,DC=pl" -AccountPassword (ConvertTo-SecureString -AsPlainText "P@ssw0rd" -Force) -Manager "CN=Jacek Stochlinski,OU=Users,OU=LabTeam,DC=capgem,DC=pl" -PasswordNeverExpires $true -server p-dc-01.capgem.pl
wtorek, 5 lutego 2013
sobota, 19 stycznia 2013
Usunięcie pustych wierszy lub wierszy zawierających wyrażenie z wielu plików tekstowych
Puste wiersze:
(gc .\fix.txt) | Where-object {$_ -ne ""} | set-content fix.txt
Zawierające wyraz "security"
$file = Get-ChildItem * -Include *.txt
foreach ($f in $file)
{
(Get-Content $f.FullName) | `
Where-Object {$_.trim() -ne "security"} | `
set-content $f.FullName
}
(gc .\fix.txt) | Where-object {$_ -ne ""} | set-content fix.txt
Zawierające wyraz "security"
$file = Get-ChildItem * -Include *.txt
foreach ($f in $file)
{
(Get-Content $f.FullName) | `
Where-Object {$_.trim() -ne "security"} | `
set-content $f.FullName
}
Przeszukiwanie plików tekstowych w poszukiwaniu ciągu znaków
Select-String -Path c:\fso\*.txt -pattern "slowo"
środa, 9 stycznia 2013
Czy można wykorzystać BITS do kopiowania folderów i podfolderów
Import-Module BitsTransfer
$source = "C:\IE"
$dest = "\\10.10.10.24\IE"
xcopy.exe /T /E $source $dest /Y
Get-ChildItem -Path $source -Recurse | ?{$_.PSisContainer} | foreach {$spath = $_.FullName.Remove(0,$source.Length+1); Start-BitsTransfer -Source $source\$spath\*.* $dest\$spath} Start-BitsTransfer $source\*.* $dest
Get-ChildItem -Path $source -Recurse | ?{$_.PSisContainer} | foreach {$spath = $_.FullName.Remove(0,$source.Length+1); Start-BitsTransfer -Source $source\$spath\*.* $dest\$spath} Start-BitsTransfer $source\*.* $dest
wtorek, 8 stycznia 2013
Symulacja wolnego łącza
W edytorze GPO:
Computer Configuration > Windows Settings > Policy-based QoS > Create new policy
W nowym oknie zaznacz Specify Outbound Throttle Rate
Computer Configuration > Windows Settings > Policy-based QoS > Create new policy
W nowym oknie zaznacz Specify Outbound Throttle Rate
Subskrybuj:
Posty (Atom)