Scripte / Powershell

USB Backup LW Korrektur

Beim Anschluss von USB Festplatten lässt sich nicht unbedingt vorhersagen welche Laufwerksbuchstaben aktiv werden. In diesen Fall möchte ich dass F: G: H: für die externen USB Festplatten verwand werden. Die USB Festplatten sind mit folgenden Bezeichnungen versehen Backup-Set-Name_F wird F: Backup-Set-Name_G wird G: Backup-Set-Name_H wird H:

$drivelabel_ext1 = Get-WmiObject -Class Win32_volume -Filter "DriveLetter = 'F:'"

$drivelabel_ext2 = Get-WmiObject -Class Win32_volume -Filter "DriveLetter = 'G:'"

$drivelabel_ext3 = Get-WmiObject -Class Win32_volume -Filter "DriveLetter = 'H:'"

$DriveLetter = @("F","G","H")


if ($drivelabel_ext1.Label -notlike '*_F' -or $drivelabel_ext2.Label -notlike '*_G' -or $drivelabel_ext3.Label -notlike '*_H')

                {

                write-host "Laufwerksbuchstaben muessen angepasst werden"

     

                    $DriveLetter | ForEach-Object {$_

                        $DRVL = $_

                        Get-Volume -Drive $DRVL -ErrorAction SilentlyContinue | Get-Partition | Remove-PartitionAccessPath -accesspath "$DRVL`:\" 

                        Get-Volume | Where-Object{$_.FileSystemLabel -like "*_$DRVL"} | Get-Partition | Set-Partition -NewDriveLetter $DRVL

                        }

                }

Batch disable Dienste 

cd \Users\root\Desktop
echo 'Stopping and Disable Services' >Dienste_Stop_Log.txt
echo. >>Dienste_Stop_Log.txt
echo. >>Dienste_Stop_Log.txt

sc query state= all >Alle_Dienste.txt

setlocal EnableDelayedExpansion

set list=MSExchangeAB MSExchangeADTopology MSExchangeAntispamUpdate MSExchangeEdgeSync MSExchangeFBA MSExchangeFDS MSExchangeIS MSExchangeMailboxAssistants MSExchangeMailboxReplication MSExchangeMailSubmission ExchangeProtectedServiceHost MSExchangeRepl MSExchangeRPC MSExchangeSA MSExchangeSearch MSExchangeServiceHost MSExchangeThrottling MSExchangeTransport MSExchangeTransportLogSearch AdobeARMservice APCPBEAgent APCPBEServer MSMFramework "Intel(R) PROSet Monitoring Service" "SuperMicro Health Assistant" "Supero SD3Service Daemon" Xitami

(for %%a in (%list%) do ( 
   sc query %%a
   echo "%date:~0%-%time:~0,8% Disable Service %%a" >>Dienste_Stop_Log.txt
   sc config %%a start= disabled >>Dienste_Stop_Log.txt
 :dienst_LOOP
   sc stop %%a
   sc query %%a | findstr /I /C:"STOPPED"
   if not %errorlevel%==0 (
 goto dienst_LOOP
)
   echo "%date:~0%-%time:~0,8% %%a STOPPED" >>Dienste_Stop_Log.txt
   echo. >>Dienste_Stop_Log.txt
))


pause

Treiberinstallation

REM *** INTEL Server Chipset Install ***

if exist "C:\Program Files\Intel\Intel(R) Chipset Device Software\CSVer.dll" goto inst_01

start /wait pnputil /add-driver .\Chipset_10.1.2.86\*.inf /subdirs /install

.\Chipset_10.1.2.86\SetupChipset.exe -s -log ..\CHIPSET_install.log


:inst_01


REM *** AMD FirePro V5900 Install ***

if exist "C:\Program Files (x86)\AMD\ATI.ACE\Core-Static\CCC.exe" goto inst_02

rem "geht nicht bei Core" .\Non-WHQL-FirePro-Win10-64Bit-NIEG-15.201.2401.1010-Feb14-2017\Setup.exe -INSTALL: /FORCE_CORECOM_TRACE:..\GRAFIK_install.log

rem "passiert nichts" pnputil -i -a .\Non-WHQL-FirePro-Win10-64Bit-NIEG-15.201.2401.1010-Feb14-2017\Packages\Drivers\amdkmafd\WT64A\amdkmafd.inf


start /wait pnputil /add-driver .\Non-WHQL-FirePro-Win10-64Bit-NIEG-15.201.2401.1010-Feb14-2017\Packages\Drivers\*.inf /subdirs /install



start /wait pnputil -i -a .\Non-WHQL-FirePro-Win10-64Bit-NIEG-15.201.2401.1010-Feb14-2017\Packages\Drivers\Display\WT6A_INF\C0311213.inf


:inst_02


REM *** INTEL RAID Treiber Install ***

if exist "C:\ProgramData\LSI\WDCFG\DriverConfigParam.def" goto inst_03

start /wait pnputil -i -a .\MR_Windows_signed_DRV_v6.713.05.00\win10_x64\MegaSAS2.inf > ..\..\RAID_install.log


:inst_03


REM *** INTEL LAN Treiber Install ***

if exist "C:\Program Files\Intel\DMIX\DiagSrv.dll" goto inst_04

start /wait .\INTEL_LAN\APPS\PROSETDX\Winx64\DxSetup.exe /qr DMIX=1 ANS=0 /liew ..\..\..\..\LAN_install.log


:inst_04


REM *** CHELSIO LAN Treiber Install ***

if exist "C:\ChelsioUwire\chHw.log" goto inst_05

start /wait .\ChelsioUwire-5.0.0.85.exe -in NIC -f .\CHELSIO_install.log


:inst_05


REM *** INTEL RAID Managment Install ***

if exist "c:\Program Files (x86)\LSI Corporation\MSM\lib\storelib.dll" goto inst_06

".\RWC2_MR6.11\Windows\ISSetupPrerequisites\VC Redist 2012 Installation\vcredist_x86.exe" /Q

start /wait .\RWC2_MR6.11\Windows\setup.exe /S /v/qn


:inst_06


exit

Konfiguration Intel 10G Adapter

REM *** Netzadapter Einstellungen ***


REM  INTEL 10GB Einstellungen



Import-Module "C:\Program Files\Intel\IntelNetCmdlets\IntelNetCmdlets.psd1"


get-netadapter |? Name -notlike vEthernet* |? InterfaceDescription -like "Intel(R) 82599 10 Gigabit*#2" | Rename-NetAdapter -NewName HyperV-B

Set-IntelNetAdapterSetting -name "Intel(R) 82599 10 Gigabit Dual Port Network Connection #2" -RegistryKey "PerformanceProfile" -RegistryValue 5

Set-NetAdapterRss –name HyperV-B –Profile NUMA

Set-NetAdapterRss –name HyperV-B –MaxProcessorGroup 0

Set-NetAdapterRss –name HyperV-B –MaxProcessorNumber 11

Set-NetAdapterRss –name HyperV-B –BaseProcessorGroup 0

Set-NetAdapterRss –name HyperV-B –BaseProcessorNumber 6



get-netadapter |? Name -notlike vEthernet* |? InterfaceDescription -like "Intel(R) 82599 10 Gigabit*Connection" | Rename-NetAdapter -NewName HyperV-A

Set-IntelNetAdapterSetting -name "Intel(R) 82599 10 Gigabit Dual Port Network Connection" -RegistryKey "PerformanceProfile" -RegistryValue 5

Set-NetAdapterRss –name HyperV-A –Profile NUMA

Set-NetAdapterRss –name HyperV-A –MaxProcessorGroup 0

Set-NetAdapterRss –name HyperV-A –MaxProcessorNumber 11

Set-NetAdapterRss –name HyperV-A –BaseProcessorGroup 0

Set-NetAdapterRss –name HyperV-A –BaseProcessorNumber 2


Get-NetAdapter -Name "HyperV-*" | Set-NetAdapterSriov -Enabled $True -NumVFs 24


Konfiguration Chelsio 10G Adapter

REM  Chelsio 10GB Einstellungen


Get-netadapter |? Name -notlike vEthernet* |? InterfaceDescription -like "Chelsio Network Adapter*#2" | Rename-NetAdapter -NewName SMB-A

Get-NetAdapter -Name "SMB-A" | Set-NetIPInterface -dhcp Disabled

wait

New-NetIPAddress -AddressFamily IPv4 -PrefixLength 24 -InterfaceAlias "SMB-A" -IPAddress 10.1.102.162


Set-NetAdapterRss –name SMB-A –BaseProcessorNumber 15

rem Set-VMNetworkAdapterVlan -VMName test-2016 -Trunk -AllowedVlanIdList 2-100 -NativeVlanId 1



Get-netadapter |? Name -notlike vEthernet* |? InterfaceDescription -like "Chelsio Network Adapter" | Rename-NetAdapter -NewName SMB-B

Get-NetAdapter -Name "SMB-B" | Set-NetAdapterAdvancedProperty -RegistryKey "*RssBaseProcNumber" -RegistryValue 17

Get-NetAdapter -Name "SMB-B" | Set-NetIPInterface -dhcp Disabled

wait

New-NetIPAddress -AddressFamily IPv4 -PrefixLength 24 -InterfaceAlias "SMB-B" -IPAddress 10.1.103.162


rem Set-DnsClient -InterfaceAlias "SMB*" -RegisterThisConnectionsAddress $false


Set-NetAdapterVMQ -Name SMB* -Enabled $False

Set-NetAdapterRss –name SMB* –Profile NUMA

Set-NetAdapterRss –name SMB* –MaxProcessorGroup 1

Set-NetAdapterRss –name SMB* –MaxProcessorNumber 11

Set-NetAdapterRss –name SMB* –BaseProcessorGroup 1

Get-NetAdapter -Name "SMB-*" | Set-NetAdapterAdvancedProperty -RegistryKey "*JumboPacket" -RegistryValue 9014