Windowspowershell en opdrachtprompt voor beginners

Nuttige commando’s voor beginners

Posted in Uncategorized by windowspowershell on May 17, 2010

A. Powershell  (een power-commandprompt) : inleiding voor beginners

Als je helemaal niets weet over een opdrachtprompt, lees dan eerst de inleiding 
die in het midden van deze pagina staat voor wat basisregels.

Deze uitleg gaat niet dieper in op de betekenis van de commando’s, noch
op de manier om deze commando’s te bouwen.
Hij heeft enkel tot taak te tonen wat men met concrete commando’s kan
uitvoeren, wat het belangrijkste is voor een leek , die gewoon iets op zijn
computer wil zoeken, maar geen systeembeheerder is die werkt met
servers.
Op Windows XP en Vista moet u het installeren, maar
het wordt meegeleverd met Windows 7.
Installeer eerst Net Framework 2 en 3.5 + eventuele updates
(dit geldt voor alle windowsversies)

Een opdracht kopiëren (=hem  plakken in de windows powershell opdrachtprompt) doe je met een rechterklik in het venster, en dan kies je “plakken” (nadat je uiteraard eerst het nodige gekopieerd hebt met CTRL + C)

Waarom dit nuttig kan zijn  : u bent een bestand kwijt
dat u vorige week (6 tot 11 dagen geleden) gewijzigd hebt,
ergens tussen dinsdag en woensdag, tussen 10 en 14 uur.

Met powershell is dit terug te vinden. Zie uitleg op het einde

Hoe start je Powershell ?
Als je een opdrachtvenster als administrator geopend hebt, hoef je
enkel te tijpen :
powershell  (en op Enter te drukken) en de volgende prompt verschijnt :
PS>

Nu kan je powershell commando’s ingeven.

Tweede methode :
In windows 7 klik je op Start  en in de zoekbalk tijp je :

Powershell

Rechterklik op “windows powershell”, en kies” vastmaken aan taakbalk”
of “vastmaken aan het startmenu”.

Rechterklik op het nieuwe Powershell in uw startmenu, kies
eigenschappen, kies “geavanceerd”, en zet een vinkje voor :
“als administrator uitvoeren”. Powershell zal altijd
starten met administratorrechten.
Klik op “toepassen” en “ok” twee keren.
Het pad is :
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe

//////////////////////////////////////////
Opgepast in windows 8 en 8.1 :
tijp gelijk waar op het metroscherm :
powershell

en je ziet “windows powershell” verschijnen
of :

Navigeer in Windows Verkenner naar :
c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe
Rechterklik in de map v1.0 hierboven op powershell.exe, en kies
“vastmaken aan taakbalk”
Rechterklik dan in de taakbalk op “powershell.exe”, en kies in het menu erboven : “uitvoeren als
administrator”.
/////////////////////////////////////////////

Start -> Klik op Powershell
Een blauw commandovenster zal openen,en je bent in :
c:\users\Administrator

Als je nu met windows verkenner naar
C:\windows\system32\WindowsPowerShell\v1.0\ navigeert, en daar
dubbelklikt op Powershell.exe, dan krijg je een purperen venster,
waarschijnlijk om aan te duiden dat je nu in een rootfolder zit, waar je
heelwat onheil zou kunnen aanrichten.

Om een commando –  dat je eerst gekopieerd hebt met CTRL+C  – te plakken in powershell
rechterklik je in het powershell-venster.

Bij het uitvoeren van gecompliceerde commando’s kan het zijn dat je
steeds de cursor ziet knipperen.
Wacht tot de voltooiing van het commando (pad wordt getoond), of breek het commando af met CTRL + C.

Welke versie van Powershell heb je ?
Om te weten welke versie van Powershell je hebt (want versie 1.0 is beperkter dan versie 2.0) , tijp :
get-host        ofwel          $host.version  ofwel
$psversiontable

Naar een andere directory gaan :
je wil van c:\windows naar schijf g: gaan, tijp  : G: (+ druk Enter)

Ga naar de map c:\script :

chdir c:\script
cd c:\script

ofwel met Set-Location :
Set-Location c:\script
Navigeer naar de root van de schijf : cd \
navigeer naar een hogere map : cd..

Maak een lijst van alle bestanden in de huidige map en haar submappen, waarbij alle bestanden met het pad lijn per lijn
weergegeven worden.

Eerst navigeer je naar de bewuste map waarvan je een lijst wil maken,
bijvoorbeeld c:\Program Files

chdir “c:\Program Files\”
Powershell alternatief voor dir /s /b  in de opdrachtprompt , dat een lijst
geeft met alle bestanden in de huidige map en alle submappen, waarbij
het volledig pad weergegeven wordt :

PS>Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName
verkorte versie van bovenstaand commando :
PS>gci -r | select -exp FullName

of :

PS>Get-ChildItem -Recurse | ForEach-Object { $_.FullName }
verkorte versie :
PS>gci -r | % { $_.FullName }
Nu zetten we de output in c:\lijst.txt. Je zal dus niets zien verschijnen op
het scherm.
Opgelet, het kan zijn dat je als gewone gebruiker niet kan schrijven  naar C:
Dan kan je de output doen naar c:\gebruikers\gebruikersnaam\Downloads
(waarbij je uiteraard het pad naar jouw situatie moet aanpassen).

gci -r | % { $_.FullName | out-file c:\lijst.txt

Navigeer naar schijf D: met
PS>D:
Geef het volgend commando in een zin om alle bestanden te zien die veranderd werden sedert
24 november 2013 :

———————————————————————————————-

PS D:\>gci -incl "*.*" -recurse | where-object {$_.lastwritetime -gt "11/24/2013"} | out-file c:\lijst.txt

———————————————————————————————–

Get-Alias

Het commando :
Get-Alias        zal elke alias (is kortere naam voor iets) op het scherm tonen.

Zo is Get-ChildItem   af te korten tot   gci  (gci is de alias voor Get-ChildItem)

Een script wordt opgeslagen als een bestand met de extensie .ps1
Om een script te kunnen uitvoeren, moet je eerst de policy veranderen.Tijp :
Get-ExecutionPolicy
Je zal zien : Restricted
Om een ps1 script te kunnen uitvoeren, tijp je :
Set-ExecutionPolicy Unrestricted
Bevestig met J (ja) ofwel Y (yes)
(en terugzetten op Restricted na het uitvoeren van het script)

——————————————-

Als je script nog niet uitgevoerd wordt, kan je nog verder gaan met :

Set-ExecutionPolicy RemoteSigned

En lukt het nog niet , dan kan je “ByPass” gebruiken :

powershell -ExecutionPolicy ByPass -File "c:\gebruikers\gebruikersnaam\Downloads\services.ps1"

Als je geen administrator bent, kan je de ExecutionPolicy enkel voor
de huidige gebruiker (CurrentUser) zetten

Set-ExecutionPolicy -Scope “CurrentUser” -ExecutionPolicy “RemoteSigned”
or

Set-ExecutionPolicy -Scope “CurrentUser” -ExecutionPolicy “Unrestricted”

Maak een script

Je kan de volgende zin rechtstreeks in powershell tijpen om ze uit te voeren ;
Aangezien de output in een htm-bestand geschreven wordt, zal je niets zien gebeuren op het scherm ;
je kan dan het htm-bestand in de map Downloads openen door erop te dubbelklikken. Je zal een overzicht van alle services zien die gestopt werden of nog actief zijn.

Get-Service | ConvertTo-HTML -Property Name, Status > C:\Users\usernaam\Downloads\services.htm

maar je kan ze kopiëren in Kladblok en opslaan als een script services.ps1 in de map c:\users\usernaam\Downloads

Het deel “c:\users\usernaam\” moet je aanpassen naar jouw situatie.

Open Powershell, en voer dit script uit.
(-ExecutionPolicy ByPass kan je toepassen als je het script van het internet
gedownload hebt, en het niet kan uitgevoerd worden wegens onvoldoende
rechten.)
Om nu het script services.ps1 uit te voeren, tijp je in powershell  terwijl je het pad “gebruikers\gebruikersnaam” aanpast naar jouw situatie :

powershell -ExecutionPolicy ByPass -File "c:\gebruikers\gebruikersnaam\Downloads\services.ps1"


Nog een nuttig commando in Powershell
Kopieer nu de volgende tekst die tussen de lijnen staat in Kladblok, en sla op als tweeUREN.txt op uw bureaublad.

Open tweeUREN.txt en kies daarna “Opslaan als”  tweeUren.ps1
Zorg dat het NIET als bestand met extensie .txt opgeslagen wordt.
———————————————————————————————–

gci -incl "*.txt" -recurse | where {([datetime]::now - $_.lastwritetime).TotalHours -lt 2}

———————————————————————————————–
gci kan je vervangen door Get-ChildItem, en where  door Where-Object
Get ChildItem probeert het pad te zoeken waar u zich nu bevindt : als u zopas
powershell vanaf het startmenu geopend hebt, bent u in  c:\users\naam-van-gebruiker\

Het bovenstaande commando begint vanaf deze plaats alle tekstbestanden te zoeken (ook in de submappen (= -recurse), die de laatste twee uren gewijzigd zijn.
Wil u .doc bestanden zoeken , verander dan “*.txt”  in “*.doc”

Sleep nu het script in een geopend powershell venster, en druk Entertoets : het net gemaakte bestand op uw bureaublad moet erin voorkomen, samen met alle andere tekstbestanden die gewijzigd werden in de laatste twee uren.

Wil u uitleg online vinden in de specifieke Powershell website van Microsoft   in het Engels  over bijvoorbeeld   Get-ChildItem , tijp dan :
help Get-ChildItem  -online

Hoe tijp ik bepaalde tekens ?
|   dit is een pipe (waarmee het ene commando het resultaat doorsluist naar een ander commando dat erop moet toegepast worden), en dat bekom je door  de rechter ALT GR toets samen met 1 (links bovenaan) in te drukken.
[ en { worden ook met de rechter ALT GR in combinatie met een andere toets bekomen
De accent grave die men hier boven è ziet, en die als backtick bekend staat op het Engelse
toetsenbord, wordt ook in Powershell gebruikt, maar kan gerust vervangen worden door
de apostrof (onder cijfer 4)

Het volgende zal alle tekstbestanden zoeken die gewijzigd zijn vanaf 14 mei 2010

get-childitem -recurse | where-object {$_.lastwritetime -gt "5/14/2010"}

Enkel tekstbestanden : voeg ” -incl *.txt” ” toe

get-childitem -incl "*.txt" -recurse | where-object {$_.lastwritetime -gt "5/14/2010"}

Dit toont de tekstbestanden die GECREEERD werden vanaf die datum. Met gecreëerd kan ook bedoeld worden : bestanden die je zopas in een nieuw aangemaakte map gekopieerd hebt, maar die al een jaar oud zijn.
Eerst navigeer je naar de bewuste map, veronderstel dat je de opdracht wil
geven voor de usb-stick G, tijp :
G: (en druk Enter)
Alle veranderde bestanden zullen als lijst weergegeven worden als je
dit tijpt :

get-childitem -incl "*.txt" -recurse | where-object {$_.creationtime -gt "5/14/2010"}

In plaats van creationtime kan je ook LastAccesTime  gebruiken : dit betekent dat je het bestand geopend hebt, maar er niets aan gewijzigd hebt.

Het volgende somt de bestanden op die gedurende de drie laatste dagen gewijzigd werden ,wat in een tekstbestand  out.txt   in c:\users\jouw-gebruikersnaam\Downloads zal opgeslagen worden. Je zal dus niets zien op het scherm, tenzij je  | out-file “pad  van het tekstbestand ” weglaat op het einde.

Get-Childitem -incl "*.txt" -recurse | where-object {$_.lastwritetime -gt $(Get-date).AddDays(-3)} | out-file "C:\Users\Administrator\Downloads\out.txt"

Wijzig -3  in -10 als u alles wil zien dat de laatste 10 dagen gewijzigd werd

In plaats van het resultaat naar een tekstbestand te schrijven, kan het ook naar het klembord
geschreven worden.
In plaats van :
| out-file “pad-van-tekstbestand”
gebruik  je
| clip        ( met spatie voor het pipe-teken)
Je zal niets zien gebeuren in de command prompt.
Als je dan Kladblok opent, hoef je enkel met CTRL+V te plakken. Het bespaart je het zoeken naar het outputtekstbestand op je harde schijf.

Bekijk alle bestanden in de huidige map en submappen (recurse), die gewijzigd werden in de laatste 2 uren :

gci -recurse | where {([datetime]::now - $_.lastwritetime).TotalHours -lt 2}

Als je enkel de tekstbestanden wil zien, zie hierboven de tekst van het .ps1 script

Nu het toetje op de taart dat ik hier gevonden heb :

http://www.energizedtech.com/2010/03/powershell-mining-through-file.html

Tussen de 6 en 11 dagen geleden heeft u in deze map of haar submappen ergens een txt-bestand
gewijzigd tussen 10 en 14 uur,op een dinsdag of een woensdag : met powershell geeft u de
volgende 3 commando’s apart in :
1. -eerst maken we een lijst van  alle tekstbestanden in deze map en in de submappen :

$FILELIST=GET-CHILDITEM –recurse –include *.txt

Dit maakt een tijdelijke lijst van alle tekstbestanden

2. – nu moeten we weten welke dag we zijn

$TODAY=GET-DATE

———————————————————————————————————————–

De volgende twee commando’s enkel ter documentatie : vind de bestanden die tussen 11 en 6 dagen geleden gewijzigd werden

$FILELIST | where { ($_.LastWriteTime –gt $Today.AddDays(-11)) –and ($_.LastWriteTime –lt $Today.AddDays(-6)) }

vind de bestanden die tussen 10 en 14 uur gewijzigd werden :

$FILELIST | where { ($_.LastWriteTime –gt $Today.AddDays(-11)) –and ($_.LastWriteTime –lt $Today.AddDays(-6)) –and ($_.LastWriteTime.Hour –gt 10) –and ($_.LastWriteTime.Hour –lt 14) }

——————————————————————————————————————————-
3. -DIT IS HET EINDCOMMANDO (dat niet kan werken zonder 1. en 2.)

$FILELIST | where { ($_.LastWriteTime –gt $Today.AddDays(-11)) –and ($_.LastWriteTime –lt $Today.AddDays(-6)) –and ($_.LastWriteTime.Hour –gt 10) –and ($_.LastWriteTime.Hour –lt 14) –and ( ($_.LastWriteTime.DayofWeek –eq ‘Tuesday’) –or ($_.LastWriteTime.DayofWeek –eq ‘Wednesday’)) }

Als je het commando in stukjes bekijkt, lijkt het logisch ;
$FILELIST | where {
($_.LastWriteTime –gt $Today.AddDays(-11))
–and
($_.LastWriteTime –lt $Today.AddDays(-6))
–and
($_.LastWriteTime.Hour –gt 10)
–and
($_.LastWriteTime.Hour –lt 14)
–and
( ($_.LastWriteTime.DayofWeek –eq ‘Tuesday’) –or ($_.LastWriteTime.DayofWeek –eq ‘Wednesday’))
}

Zoeken in tekstbestanden of binaire bestanden met Powershell.


Powershell vanaf windows 8 en versie 3.0 output naar tekst : recording everything in powershell

Open een administrator command prompt, en tijp :
powershell

stel dat je een powershellscript hebt :
C:\Users\Administrator\Downloads\Spectre_MELTDOWN_SpeculationControl\powershellscript\SpeculationControl.psd1

En je wil alles wat je tijpt in Powershell en het resultaat hiervan registreren in een tekstbestand ; dit doe je met “start-transcript” en “stop-transcript”

start-transcript C:\Users\Administrator\Downloads\test1.txt

Geef nu de 8 volgende commando’s in :

$SaveExecutionPolicy = Get-ExecutionPolicy

#

Set-ExecutionPolicy RemoteSigned -Scope Currentuser

(change directory to the folder (“powershellscript”) in which you find the powershell script “SpeculationControl.psd1”)

cd "C:\Users\Administrator\Downloads\Spectre_MELTDOWN_SpeculationControl\powershellscript"

 

Import-Module .\SpeculationControl.psd1

Get-SpeculationControlSettings

Set-ExecutionPolicy $SaveExecutionPolicy -Scope Currentuser

Stop-Transcript

Nu kan je in de map C:\Users\Administrator\Downloads\ het tekstbestand “test1.txt” bekijken


B. Command prompt of opdrachtprompt : inleiding voor Windows 7 en 8 (sommige uitleg is ook
nog geldig voor Windows XP)

EEN OPDRACHTPROMPT OP DE TAAKBALK

Tijp in de zoekbalk van windows 7 :        command prompt
Bovenaan zie je dan de command prompt verschijnen
rechterklik erop en kies : vastpinnen op Startmenu
Kies nu :
Start
rechterklik bovenaan in het Startmenu op “command prompt”
Kies “eigenschappen”, geavanceerd,
Duid aan : “als administrator uitvoeren”
Klik op OK, en dan op Toepassen

Kies terug
Start
Rechterklik bovenaan op “command prompt”,
en kies : vastmaken aan Taakbalk
Zo heb je steeds een administrator command prompt binnen bereik.

COMMAND PROMPT IN HET VAK “UITVOEREN”

Start – Uitvoeren

Tijp :
cmd /k
gevolgd door het commando
Belangrijk : je zal een gewone cmd.exe hebben,
geen administrator command prompt als je zelf gewone gebruiker bent

Met een SHIFT + rechterklik op het vak uitvoeren kan je een
administrator opdrachtprompt krijgen.

NAVIGEREN IN EEN COMMAND PROMPT
cd..

Met cd..  ga je een niveau hoger
je bent in c:\users\administrator\downloads
tijp :
cd..  (en druk Enter)
Nu ben je in c:\users\administrator

cd

Met cd kan je naar een map navigeren BINNEN DEZELFDE PARTITIE
je bent in c:\users\administrator
tijp  :                       cd c:\dd (en druk Enter)
Nu ben je in c:\dd

cd /d
Met cd /d  kan je rechtstreeks naar een andere partitie e:\
je bent in c:\dd
je wil naar e:\addon.
(met dit commando cd  e:\addon  blijf je in c:\dd)   
Je moet tijpen   :
cd /d 
e:\addon
(en druk Enter) om in e:\addon te geraken

cd /
Met cd /  geraak je in de root van de harde schijf
c:\Users\Administrator\Downloads
Je wil direct naar de root van c (c:)
tijp :       cd   /
en druk Enter. Je bent nu in c:
c:>

Je wil van c:>  naar schijf e:
tijp     e:
en druk Enter.

Vlugge manier
In windows verkenner duid je de bewuste map aan, en je sleept ze in
het opdrachtpromptvenster. Dit lukt niet in een  administrator  opdrachtprompt.

Pijltoets naar boven of naar beneden om naar voorgaande commando’s te gaan
Met pijltoetsen naar boven kan je de voorgaande commando’s zien

F7
Druk F7  om de historiek van alle commando’s te zien ; je kan dan
met pijltoetsen navigeren naar het bewuste commando.

KOPIEREN EN PLAKKEN BINNEN EEN OPDRACHTPROMPT

Met een rechterklik op de blauwe balk bovenaan kies je “bewerken”, “selecteer alles” of “selecteren”
Selecteer het nodige, druk Entertoets om te kopiëren. Dan duid je de plaats aan waar het gekopieerde
fragment moet komen, en kies je met een rechterklik “plakken”. Of je gaat buiten de command prompt, en
daar kan je bijvoorbeeld in “kladblok” plakken met CTRL + V.
Heb je iets gekopieerd van buiten de command prompt, dan kan je dit in een command prompt plakken met
een rechterklik, en kies plakken.
Dit kan gemakkelijker
Rechterklik op de titelbalk van de opdrachtprompt, en kies “eigenschappen”.
In de tab “opties”, kies “bewerken”
Kies dan “MODUS SNEL BEWERKEN”

Dit werkt alsof  “selecteren” reeds aanstaat.
Je hoeft alleen nog de lijn te selecteren zodat ze onmiddellijk  naar het klembord gekopieerd wordt.
Het vergemakkelijkt het proces om iets vanuit het klembord in de opdrachtprompt te kopiëren. Slechts 1 keer rechtsklikken en het wordt automatisch vanuit het klembord gekopieerd, zonder dat je “plakken” hoeft
aan te duiden.

OPEN WINDOWS VERKENNER VANUIT EEN OPDRACHTPROMPT

Tijp : explorer  (en druk Entertoets)

TOON DE INHOUD VAN DE HUIDIGE MAP
dir

Als er teveel getoond wordt, kan je pagina per pagina tonen.

Daarvoor gebruiken we het pipe-teken met MORE
pipe vorm je door tegelijk de rechter AltGr toets EN  de cijfertoets 1  links bovenaan
in te drukken op een Belgisch azerty toetsenbord.

dir /s | more
Door op de spatietoets te drukken, zie je de volgende pagina.
Door op de entertoets te drukken, zie je de volgende zin.

Hetzelfde kan je doen met dir /s /P
P is PAUZE
Door op gelijk welke toets te klikken zie je de volgende pagina.

EEN OPDRACHT ONDERBREKEN IN EEN OPDRACHTPROMPT

Druk de toetsen CTRL + C

 

MAP MET SUBMAPPEN KOPIEREN NAAR EEN ANDERE LOCATIE

Met  xcopy :

xcopy D:\*.* /s /e /f H:\ Met robocopy :  Met robocopy robocopy D: H: /MIR /V /FP

 

de nieuwe /MT switch laat multithreaded kopiëren toe

Voor een incrementele backup heb je geen gesofistikeerde software nodig.

Gebruik deze opdracht :
robocopy c:\gebruikers\tim\documenten f:\backup\documenten /copyall /e /r:0 /dcopy:t /mir

Met xcopy wordt dit :
xcopy c:\gebruikers\tim\documenten f:\backup\documenten /c /d /e /h /i /k /q /r /s /x /y

AUTOMATISCH AANVULLEN MET DOSKEY

Tijp    doskey     om ervoor te zorgen dat autocomplete geactiveerd wordt
Als je    d    tijpt, kan je met de Tab-toets alle mogelijkheden zien.

ALIASSEN TOEKENNEN MET DOSKEY

Je  kan nog meer met doskey (maar dit blijft slechts geldig gedurende de
huidige sessie)
C:> doskey cd=cd/d $*
Daarmee geef je aan dat door     cd     te tijpen, je automatisch     cd  /d
tijpt, waardoor je gemakkelijk van de ene partitie naar de andere kan
overschakelen
Als je in c:\dd   bent, kan je nu gemakkelijk tijpen :
cd d:\temp
In feite maak je een tijdelijke alias voor de sekwentie  “cd  /d”   (namelijk    cd)

Een alias maken met Swiss file knife :
http://stahlworks.com/dev/swiss-file-knife.html
http://stahlworks.com/dev/index.php?tool=alias

ZELF ALIASSEN MAKEN MET BATCHBESTANDEN
IN HET PAD C:\Windows\system32

Maak nu een batchbestand om onmiddellijk van
c:\dd   naar e:\addon te gaan :
open notepad en tijp dit :
@cd /D e:\addon
Opslaan als  eaddon.bat   in de map  c:\windows\system32
(dat het standaard pad is)
Je bent in c:\dd
Je tijpt   in een commandprompt  :   eaddon
en je bent nu in   e:\addon

Batchbestand bewerken in een opdrachtprompt

Om vlug een batchfile in de huidige map
te veranderen(als je in c:\windows\system32 bent
moeten de .bat-bestanden daar ook zijn),
tijp je :
notepad eaddon.bat
Je kan ze dan veranderen en terug opslaan.

clip

dir | clip

Het bovenstaande  kopieert de inhoud van het commando dir naar het klembord

clip < myfile.txt

Dit kopieert de inhoud van myfile.txt naar het klembord

echo [text] | clip
Met de opdracht echo kan je het tekstfragment “[text]” naar het klembord kopiëren

HET RESULTAAT VAN EEN COMMANDO IN EEN TEKSTBESTAND
OPSLAAN OF AAN EEN ANDER PROGRAMMA DOORGEVEN MIDDELS EEN
PIPE

dir > c:\dir_resultaat.txt
Je zal het resultaat van dir zien in het tekstbestand dir_resultaat.txt

Nu wil je in hetzelfde bestand het resultaat van ipconfig /all opslaan.
Dit doe je met >>
ipconfig /all >> c:\dir_resultaat.txt

De resultaten van een commando doorgeven aan een ander programma

clip is het klembord
dir | clip
Dit geeft het resultaat van het commando dir door aan het commando clip (is het klembord)

Als je de opdrachtprompt sluit, zit die inhoud nog altijd in het klembord
Binnen windows open je Kladblok, en met CTRL + V plak je nu deze inhoud vanuit het klembord.

ver
– dit toont de versie van je huidig systeem

 

whoami  en    whoami /groups
Om de huidige gebruiker te zien en te weten tot welke groep hij behoort, tijp je whoami in de opdrachtprompt

Dit is handig als je verschillende opdrachtpromptvensters open hebt staan , die je met “uitvoeren als beheerder” geopend hebt.

subst

De meesten van ons gebruiken subst om ervoor te zorgen dat
een heel lang pad (C:\Users\Administrator\Downloads) tijdelijk een virtuele schijf R: wordt  (na een reboot is de virtuele schijf verdwenen) :
subst R: “C:\Users\Administrator\Downloads”

Nu zal je in Windows Verkenner een nieuwe schijf R:  zien

De virtuele schijf R: wissen doe je zo :
subst R: /D

Geef de lijst met de huidige virtuele schijven met de opdracht :
subst

OPGEPAST :
1. een lang pad MAG NIET eindigen op een backslash
2. een root-pad ( c:   of zo)  MOET eindigen op een backslash.

Dit is correct:
subst R: “C:\Users\Administrator\Downloads”
subst R: C:\
dit is fout :
subst R: C:
subst R: “C:\Users\Administrator\Downloads\”

Gevallen waarin subst.exe gebruiken nut heeft

* Stel dat een programma enkel drive c: als installatiefolder wil, maar jouw besturingssysteem is geïnstalleerd in
D: , dan kan je tijdelijk D:\program files   laten vervangen door c:
subst C: “D:\Program Files”

Verwijder virtuele schijf  C:
subst C: /D

EEN ANDER PASWOORD VOOR “Administrator”

Je moet ingelogd zijn als administrator, en tijpt in een opdrachtprompt :
net user administrator *
Tijp nu het nieuwe paswoord

Tweede methode :
net user Administrator anderpaswoord
Nu kan je inloggen met het paswoord “anderpaswoord”

TOON DE LIJST VAN ALLE GEBRUIKERS
net user
geeft de lijst van alle gebruikers

net user Administrator
of
net user “naam van de gebruiker”
geeft alle details over gebruiker

INLOGGEN ZONDER PASWOORD
Tijp het volgende en druk op Entertoets
netplwiz

ofwel
control userpasswords2
Hier kan je wijzigen.

VERGELIJK DE INHOUD VAN BESTANDEN
fc c:\command.txt d;\command.txt
De verschillen worden getoond

FREKWENT EEN IP-ADRES BEKOMEN
Open kladblok en tijp :

ipconfig /release
ipconfig /renew
exit
Bewaar dit tekstbestand en kies “opslaan als” “verversIP.bat”

DOSKEY

Doskey is heel handig, en deze zinnen staan in elk batch-script die ik maak :
doskey d=dir $*                         tijp  d       in plaats van  dir
doskey n=notepad $*              tijp   n     om notepad te openen
doskey ..=cd ..\..                        tijp   ..    om direct twee niveaus hoger te geraken
doskey …=cd ..\..\..                 tijp  …    om direct drie niveaus hoger te geraken

TYPE
Toon de inhoud van een tekstbestand zonder dat het veranderd kan worden.
De opdracht :
type inhoud.txt
zal de inhoud tonen

NSLOOKUP
Geeft het ip-adres van een website
nslookup google.com

ATTRIB
Wijzig de attributen van een bestand, bijvoorbeeld verborgen (h)
Maak een bestand zo.txt in C:
Nu zorgen we ervoor dat dit bestand het attribuut “verborgen” krijgt
attrib +h c:\zo.txt

Als je in Windows Verkenner, onder “beeld” aangegeven hebt dat je verborgen bestanden wil zien, dan zal het het nog wel zien
Heb je aangegeven dat de verborgen bestanden niet mogen verschijnen in Verkenner, dan zie je dit tekstbestand niet meer.
Om het attribuut terug te verwijderen, tijp in een opdrachtprompt :
attrib -h c:\zo.txt

R – Read-only is Alleen-lezen
A – Archive is Archief
S – System is Systeem
H – Hidden is verborgen

 VERWIJDER EEN MAP MET ALLE SUBMAPPEN

rmdir /s mapnaam
de map “mapnaam” met al haar submappen wordt verwijderd.
Er wordt gevraagd of je wel zeker bent ?
Tijp :
y

VERWIJDER BESTANDEN
Verwijder alle bestanden in de map c:\mapnaam met het commando :
del c:\mapnaam
Bevestigen door te tijpen:
y
De map “mapnaam” is leeg
RD c:\mapnaam
verwijdert de lege map mapnaam.

DEL *.DOC  zal alle bestanden met extensie .doc verwijderen
del *.* verwijdert alle bestanden in een map
DEL Test*.*  verwijdert alle bestanden die beginnen met Test

Om een verborgen bestand te verwijderen moet je de /h switch gebruiken
del c:\zo.txt /h

 

HELP

Als u dit      /?   tijpt na een commando ziet u alle switches van een opdracht
dir /?     geeft volgende uitleg

DIR [station:][pad][bestandsnaam] [/P] [/W] [/D] [/A[[:]kenmerken]]
[/O[[:]volgorde]] [/T[[:]tijdsveld]] [/S] [/B] [/L] [N] [/X] [/C]

/A         Bestanden met opgegeven kenmerken weergeven.

/AH   ATTRIBUTE HIDDEN  (toon alleen de bestanden met attribute : verborgen)
/AA   ATTRIBUTE ARCHIVE (toon alleen bestanden met attribute : archief)
/AAH   ATTRIBUTE ARCHIVE AND HIDDEN (toon best. met attribute  archief EN verborgen)
/AHS   ATTRIBUTE HIDDEN AND SYSTEM (toon best. met attribute verborgen EN systeem)
/AS    ATTRIBUTTE SYSTEM (toon bestanden met attrib  systeem)
/AR    ATTRIBUTE READONLY (bestanden met attribuut alleenlezen)
/AD    (bestanden met attribuut Directories / Mappen)
/AI             I  Not content indexed files
/AL            L Reparse Points
–                minteken ervoor : betekenis NIET, BIJV  /A-H
/A-H    alle bestanden die NIET het attribuut “verborgen” hebben

/B         Kaal formaat gebruiken (geen heading-gegevens of samenvatting).
/C         Het duizendtal-scheidingsteken weergeven in bestandsgroottes.
Dit is de standaardinstelling. Gebruik /-C om het weergeven van
het scheidingsteken uit te schakelen.
/D         Zelfde als brede-lijstsortering maar bestanden worden per
kolom gesorteerd.
/L         Kleine letters gebruiken.
/N         Nieuwe indeling (lange lijst) waarbij bestandsnamen rechts
worden weergegeven.

/O  Bestandslijst in gesorteerde volgorde.

/ON    N   alfabetisch op naam
/OS    S   op grootte (kleinste eerst)
/OE    E   op extensie (alfabetisch)
/OD    D   op datum/tijd (oudste eerst)
/O-D
/OG    G mappen eerst groeperen
– minteken ervoor voor omgekeerde volgorde
/O-D     zal op datum sorteren (maar nu de oudste laatst)
/O-S     ZAL op grootte sorteren, maar nu de grootste eerst

/P         Wachten na elk gegevensscherm.
/Q         De eigenaar van het bestand weergeven.

/R          Toon alternate data streams van een bestand (alleen in NTFS-schijven)
/S         De bestanden in opgegeven map en alle submappen weergeven.

/T   Het tijdsveld dat wordt weergegeven of gebruikt voor sorteren.

/TC    tijdstip waarop het bestand werd gemaakt
/TA    laatst gebruikt
/TW    laatst gewijzigd

/W         Brede-lijstsortering.
/X         De korte namen weergeven die zijn gemaakt voor bestanden die
geen 8-punt-3-bestandsnaam hebben. De weergave is als bij /N,
waarbij de korte naam voor de lange naam wordt geplaatst.
Als er geen korte naam beschikbaar is, worden spaties
weergegeven.
/4         Jaartallen met vier cijfers weergeven.

Nu  de commando’s die hopelijk nuttig voor u zijn

U kopieert hier de commando’s met CTRL + C,  opent dan een command prompt, en  plakt ze met een rechtsklik en dan een klik op “plakken”.
Zorg ervoor dat de commando’s niet gesplitst worden, ze moeten als 1 lange zin uitgevoerd worden.

Dit geeft een lijst van alle bestanden (ook in de submappen)
– gesorteerd op de tijd wanneer ze gewijzigd werden (written : W)
dir [volledig pad] /TW /4 /OD /S /P
Dir %USERPROFILE% /TW /4 /OD /S /P

Dir %USERPROFILE% /TW /4 /OD /S /P ofwel : Dir "C:\Users\Administrator" /TW /4 /OD /S /P Vervang Administrator door uw gebruikersnaam

U kan uiteraard ook een ander pad opgeven, en %USERPROFILE%
vervangen door het pad tussen aanhalingstekens
Een map die een naam bevat met een spatie plaats je zeker
tussen aanhalingstekens.

Als de opsomming te lang wordt, voegen we /P toe. Dit laat toe
dat er gepauzeerd wordt na elk vol scherm, zodat je alles kan zien.
We laten nu de /P weg, alle bestanden rollen over het scherm,
maar u kan dat stoppen met CTRL + C.

We kunnen nu het resultaat schrijven  in een tekstbestand op
het bureaublad  met
>  “pad naar tekstbestand” (spatie voor en na > )
(met een Nederlandse versie zal u allicht Desktop moeten vervangen door Bureaublad.
%userprofile% is voor alle talen hetzelfde, evenals %windir% (= c:\windows))
Dir %USERPROFILE% /TW /4 /OD /S > %USERPROFILE%\Desktop\result.txt

Dir /a  zal ook de verborgen bestanden tonen
Dir /a %USERPROFILE% /TW /4 /OD /S > %USERPROFILE%\Desktop\result2.txt

Dit zal ENKEL de verborgen bestanden tonen :
Dir %USERPROFILE% /TW /4 /OD /S /AH > %USERPROFILE%\Desktop\result3.txt

Nu willen we enkel de tekstbestanden zien :
Dir %USERPROFILE%\*.txt /TW /4 /OD /S /P
Dir %USERPROFILE%\*.txt /TW /4 /OD /S > %USERPROFILE%\Desktop\result4.txt

Met volledige padnaam

Lijst met de volledige pad-naam van alle bestanden, ook in submappen:
DIR %USERPROFILE% /B /S > %USERPROFILE%\Desktop\spu.txt

Dit geeft enkel de tekstbestanden :
DIR %USERPROFILE%\*.txt /B /S > %USERPROFILE%\Desktop\spu2.txt

DIR /a %USERPROFILE% /B /S > %USERPROFILE%\Desktop\spu1.txt

dir /a zal ook alle verborgen bestanden weergeven : zie commando hierboven.
———————————————————————————————————————————–

C. Make partitions writable in Linux
In Linux UBUNTU een externe schijf die aangesloten is via usb-atapi-adapter, en die voorheen compleet
gewist werd, formatteren in ext3, zodat ze vanuit elke linux-distro en door elke gebruiker kan gebruikt
worden om bijvoorbeeld met dd of met gddrescue van Antonio Diaz images te maken van interne harde schijven
gparted cd opstarten , steek daarna de externe schijf via usb-atapi in.

rechterklik in lege ruimte : new partition (je neemt de default instelling = van het type msdos)

primary partition
ext 3
rechterklik : formatteren als ext 3
sluit de gparted cd af.

start de ubuntu live-cd , na de start plug je de externe
disk in, en met een rechterklik unmount je ze terug

open terminal :
sudo su
sudo fdisk -l
ofwel    sudo lshw -C disk
(je ziet dat de externe schijf sdb1 is)

sudo mkdir /media/sdb1

mount de externe schijf :

sudo mount -t ext3 /dev/sdb1 /media/sdb1

cd /media/sdb1
sudo chown root:users /media/sdb1
sudo chmod 777 /media/sdb1

Geldt ook voor ext2

Gebruik van gddrescue
————————————————————————————————————————————
D.(Tip 21) Activatiegegevens windows 7 opslaan

Pas “E:\act” aan als u de activatiegegevens wil opslaan in een andere map, en sla ze voorgoed
op op een usb-stick. Zorg dat u met sleutel.exe ook uw activatiesleutel opslaat, en zet erbij voor
welk type installatie dit geldt (homepremium retail,  homebasic OEM, of zo)

In een administrator prompt :

Take ownership in de map system32 (EN de map SYSWOW64, als je EEN 64-bit-systeem hebt)
net user administrator /active:yes

takeown /f "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms"
Het volgende is ook nodig bij 64-bit-systemen :
takeown /f "%SystemDrive%\Windows\SysWOW64\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms"

net user administrator /active:yes

icacls "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" /grant administrators:F
icacls "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms" /grant administrators:F
Het volgende is ook nodig bij 64-bit-systemen  :
icacls "%SystemDrive%\Windows\SysWOW64\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms" /grant administrators:F

nu kan je ze backuppen naar de map e:\act.. (pas de mapnamen aan zodat
ze de uwe weerspiegelen)

xcopy "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" "E:\act\tokens"
xcopy "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms" "E:\act\sys32"
Het volgende is ook nodig bij 64-bit-systemen :
xcopy "%SystemDrive%\Windows\SysWOW64\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms" "E:\act\wow64"

Terugzetten doen we zo (pas de mapnamen e:\act...  aan zodat ze de uwe weerspiegelen)

net stop sppsvc /y
net user administrator /active:yes

takeown /f "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms"
Het volgende is ook nodig bij 64-bit-systemen :
takeown /f "%SystemDrive%\Windows\SysWOW64\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms"

net user administrator /active:yes

icacls "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat" /grant administrators:F
icacls "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms" /grant administrators:F
Het volgende is ook nodig bij 64-bit-systemen  :
icacls "%SystemDrive%\Windows\SysWOW64\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms" /grant administrators:F

del "%WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform\tokens.dat"
del "%WinDir%\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms"
Dit is ook nog nodig bij 64-bit-systemen :
del "%SystemDrive%\Windows\SysWOW64\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms"
Hiermee worden onze backupgegevens teruggeschreven :
xcopy "E:\act\tokens\tokens.dat" %WinDir%\ServiceProfiles\NetworkService\AppData\Roaming\Microsoft\SoftwareProtectionPlatform
xcopy "E:\act\sys32\pkeyconfig.xrm-ms" %WinDir%\System32\spp\tokens\pkeyconfig
Het volgende is ook nog nodig bij 64-bit-systemen :
xcopy "E:\act\wow64\pkeyconfig.xrm-ms" %SystemDrive%\Windows\SysWOW64\spp\tokens\pkeyconfig

net start sppsvc

Nu geven we de productsleutel ter activatie in :

cd %windir%\system32\
slmgr.vbs -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
In plaats van de xxxx...  vult u uw productsleutel in, die u gevonden had
met "sleutel.exe"
 (voldoende lang wachten tot het commando slmgr.vbs -ipk  uitgevoerd is)
slmgr.vbs -ato
Voldoende lang wachten na commando
Uw nieuwe installatie wordt geactiveerd.
Controleer nu de status van de activatie met een van  volgende
commando's :
slmgr.vbs -dlv

http://www.mydigitallife.info/2009/09/24/how-to-backup-and-restore-windows-7-and-server-2008-r2-activation-status-activate-offline-on-reinstall/

"Take ownership" : getijpte commando's in command prompt in plaats van tip 57Open een opdrachtprompt met administratorrechten en tijp

(voor bestanden : )

takeown /f C:\Windows\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms /d y
 icacls C:\Windows\System32\spp\tokens\pkeyconfig\pkeyconfig.xrm-ms /grant administrators:F

[Take ownership Voor mappen (doet dit ook voor onderliggende mappen))

takeown /f "%WinDir%\System32\spp\tokens\pkeyconfig" /r /d y
icacls "%WinDir%\System32\spp\tokens\pkeyconfig" /grant administrators:F /t
Vervang "%WinDir%\System32\spp\tokens\pkeyconfig" door het pad van de map die u nodig heeft.

Als je niet wil dat je ook adminrechten krijgt voor de onderliggende mappen, verwijder de
/r” en “/t” switch.]
——————————————————————————————————————-
Verwijder nu het bestand “pkeyconfig.xrm-ms”
Kopieer de backup die je opgeslagen had op je usb-stick naar de map
C:\Windows\System32\spp\tokens\pkeyconfig\

Navigeer naar volgende map :

C:\Windows\ServiceProfiles\NetWorkService\
AppData\Roaming\Microsoft\SoftwareProtectionPlatform\
Rechterklik op    tokens.dat     en kies “Take ownership”
Verwijder dit bestand, en plaats het backup-bestand dat je op je usb-stick

opgeslagen had terug.
Open nu een command prompt met administratorrechten, en tijp
net start sppsvc
U opent een opdrachtprompt met administratorrechten en tijpt :

slmgr.vbs -ipk xxxxx-xxxxx-xxxxx-xxxxx-xxxxx
In plaats van de xxxx…  vult u uw productsleutel in, die u gevonden had
met “sleutel.exe”

slmgr.vbs -ato

Uw nieuwe installatie wordt geactiveerd.
Controleer nu de status van de activatie met een van  volgende commando’s :
slmgr.vbs -dlv
(in het pop-up venster dat verschijnt, ziet u het aantal resterende  activeringen)
slmgr.vbs -dli

___________________________________________________________________________________________
E. WINBUILDER : making a graphical winpe 3.0  or  3.1 (also for 64-bit winpe !)

We have windows 7 installed (with or without sp 1), and we want a live-cd, so we can boot the system with it. Winbuilder will make a winpe with a graphical user interface, with explorer.exe as your file manager.

Needed programs

you install 7-zip
http://www.7-zip.org/download.html

you install the waik (Windows Automated Installation Kit, a 1.3 gb iso); if you want a dutch waik, you have to select the iso in that  language.
http://www.microsoft.com/downloads/en/details.aspx?FamilyID=696dd665-9f76-4177-a811-39c26d3b3b34

In Winbuilder , you will have to choose a windows 7 install dvd as the source (right pane : the tab that says “Source”) , preferably the same language and category (windows home premium 32 bit dutch) as the system you’re working on. As every win 7 install dvd contains almost every
category of windows 7 (basic, home premium, ultimate, etc), winbuilder will always choose
the  Wim of Win 7 ULTIMATE  to work with.

Always make a 32_bit-iso on a 32_bit-system, and a 64-bit iso on a 64 bit system.
Beware that you can not execute a 64-bit winpe on a uniquely 32-bit processor ,
while 32-bit winpe’s can work on some 64-bit processors.

Here is a program (you need to have Net Framework installed) to check if your processor supports 64 bit.
Download here “is6432os.vbs” and double-click it. It will specify if your operating system and processor are 32 bit or 64 bit :
http://www.yts.com.au/code_repo/?Dir=/commandline/robvanderwoude.com/is6432os/

You can download one of the following iso’s :

32-bit  professional retail Nederlands – dutch (replace  hxxp  door http  in notepad)
hxxp://msft-dnl.digitalrivercontent.net/msvista/pub/X15-79642/X15-79642.iso

64-bit professional retail Nederlands – dutch (replace  hxxp  door http  in notepad)
hxxp://msft-dnl.digitalrivercontent.net/msvista/pub/X15-79945/X15-79945.iso

Windows 7 home premium english retail 32 bit
hxxp://msft-dnl.digitalrivercontent.net/msvista/pub/X15-65732/X15-65732.iso

Windows 7 Home Premium english retail x64 (64-bit)
hxxp://msft-dnl.digitalrivercontent.net/msvista/pub/X15-65733/X15-65733.iso

These are all iso’s without service pack 1 integrated.

How to use these iso’s ?

I used the information on this page
http://www.mydigitallife.info/how-to-create-and-make-bootable-windows-7-iso-from-exe-plus-setup1-box-and-setup2-box-files/
(beware : the command with oscdimg.exe contains a mistake ; use the command on my webpage)

In order for everything to work, you need to be administrator , and you need 7 gb free space on your c: drive.
If you download a 64-bit, you will have to do the process on a 64-bit computer.
If you download a 32-bit iso, then you can do it on a 32 bit computer.

You burn the iso to a dvd
On this dvd, you will now see three files.  Copy these 3 files to the root of the C:  drive.
Windows 7-P-Retail-nl-NL-x64.exe
setup1.box
setup2.box

Then execute Windows 7-P-Retail-nl-NL-x64.exe by double-clicking.
This will create the folder C:\expandedSetup  (which you can later use as “source” in winbuilder ; winbuilder extracts the
best wim-file, which is Ultimate (as every install dvd contains almost all versions of windows 7))

You can now delete the 3 files mentioned above (.exe and .box files)

You will need the file oscdimg.exe, and you have to put it in c:\windows\system32
Download the file here :
http://depositfiles.com/files/d8zxuifur
Or you can use the oscdimg that came with the installed WAIK :
– for 64 bit, navigate to :
C:\Program Files\Windows AIK\Tools\amd64\
and open a command prompt (Shift + rightclick +  “open a command prompt here”) to use
oscdimg.exe
– for 32 bit, navigate to:
“C:\Program Files\Windows AIK\Tools\x86\”
and open a command prompt (Shift + rightclick +  “open a command prompt here”) to use
oscdimg.exe
Now we will create the official install DVD  with the following command : (-lWIN_NL_DVD  is the label name ;
change it accordingly to -lWIN_EN_DVD  if you have an English install dvd)
_______________________________

oscdimg.exe -bC:\expandedSetup\boot\etfsboot.com -u2 -h -m -lWIN_NL_DVD C:\expandedSetup\ C:\Win7.iso

_____________________________________

In order not to have issues with drivers that have been backed up with Drivergenius pro, I’m making a winbuilder iso – the source of which is a windows 7 without service pack 1 – on a Windows 7 without service pack 1.
Equally : if your system is in dutch,  you’d rather take a dutch dvd as source (however it will also work if your source dvd
is an english one)
I make a winbuilder iso,  which uses as source ” win 7 with service pack 1 always on a windows 7 with
service pack 1 . Important : if you do the latter, you will have to update the WAIK, and download the supplement iso
in the same language of the Waik you installed earlier :

http://www.microsoft.com/downloads/en/details.aspx?FamilyID=0aee2b4b-494b-4adc-b174-33bc62f02c5d
Burn the iso as an image to dvd with Imgburn, and put the dvd in the drive.
You open an administrator command prompt, and type the following command if your dvd-drive has drive letter E :

xcopy E:\ "C:\Program Files\Windows AIK\Tools\PETools" /ERUY 

The supplement iso to the Waik is necessary to manipulate install dvd’s of Windows 7 WITH service pack 1.

Now download a special version of winbuilder here. It contains a Setkeyboard-script with support for the three current Belgian azerty-keyboards, and other obscure keyboard layouts (original script from Vistape, changed to incorporate the 3 Belgian layouts). Look further down for the details.

http://dl.dropbox.com/u/335843/Win7PE_SE_2011_07_23.zip

After you downloaded this file, you can unzip it.
In the folder “Win7PE_SE_2011_07_23”, you will see a second folder
Win7PE_SE_2011_07_22
!!!! VERY IMPORTANT FOR WINBUILDER IN ORDER TO WORK : you copy this last folder  to the root of the c-drive
The path MUST be C:\Win7PE_SE_2011_07_22
AND Remove the following subfolders :
-In the folder C:\Win7PE_SE_2011_07_22\Projects\Win7PE_SE\Drivers\AudioDriver”,
you must remove the subfolders (as the drivers are specific to my hardware only)
-In the folder C:\Win7PE_SE_2011_07_22\Workbench\Common\Drivers_x64″ AND in the folder   “C:\Win7PE_SE_2011_07_22\Workbench\Common\Drivers_x86”,
you must remove the subfolders (as these drivers are specific to my hardware only)
Last win7pe_se complete package of 130 mb zipped you can get here :
http://w7pese.cwcodes.net/Compressed/

64-bit winpe

In the folder  “C:\Win7PE_SE_2011_07_22\Projects\Win7PE_SE\Build”  you find “5-Wow64.script.txt”
Rename this to 5-Wow64.script
This script needs to be activated to create a 64-bit winpe.

In order to execute winbuilder, double-click  (in the folder C:\Win7PE_SE_2011_07_22)  win7PESE_builder.exe

Beware that winbuilder downloads applications from the web. Sometimes applications are found on a newer, different web address.
As soon as this address changes, the script can’t be executed, and the build process will be stopped.
The only thing you can do, is not to include the recalcitrant app, or to search for
the updated script.
http://reboot.pro/12427/
http://reboot.pro/14611/page__st__45

If you want to use the same windows 7 install iso over and over again, and want to speed up the winbuilder process, don’t use the physical  dvd, make an iso of it with Ultraiso.
Make the folder c:\sourcedvd, extract the iso to c:\sourcedvd with Rt_7_lite
Tip : if you have downloaded one of the iso’s above, let’s say the 64 bit professional dutch without SP1, instead of using a generic name like c:\sourcedvd, you can make a folder  c:\64bitPROdutchWITHOUTsp1
This will be a huge help if you extract different iso’s.

http://www.rt7lite.com/downloads.html
32 bit
rt_7_lite_win7_Vista_x86.exe
rt_7_lite_win7_Vista_x86_sp1.exe    (if your win 7 already has service pack 1 installed)

64 BIT
rt_7_lite_win7_Vista_x64.exe
rt_7_lite_win7_Vista_x64_sp1.exe (if you have sp1 already installed on your win 7)

And in Winbuilder, you point to C:\sourcedvd   as “source”. This will speed up the winbuilder process.
Or you could use the folder  C:\expandedSetup ,  mentioned above ,    as your source.

To have your native keyboard layout – especially if you belong to a small nation with obscure keyboard settings – you will have to leave “system locale” on “auto” ( click on “script” in the right panel  and in the left panel on “main configuration”. In the right panel you will  see “system locale”. It”s on “auto” by default.

Now, in the left panel, under “Build” , you mark “Set keyboard” , you can now choose the keyboard you want in the right panel by using the arrow to scroll down.

To have my correct Belgian dutch azerty keyboard, I choose “813 Belgian point”
There is a script that will also copy time settings : under “components” in the left pane, you mark “HostOS import manager”.

You can even add some keyboards by rewriting the script “keyboard.script” that you find in the folder
“C:\Win7PE_SE_2011_07_22\Projects\Win7PE_SE\Build”
You can find the necessary data of very special keyboards at the bottom of this webpage :
http://gverswijvel.wordpress.com.

If you build a 32-bit ISO, rename the script 5-Wow64.script ( in the folder
c:\Win7PE_SE_2011_07_22\PROJECTS\Win7PE_SE\BUILD\) temporarily to 5-Wow64.script.txt

You’re on a 64 bit system and you’re planning to use this bootable winbuilder live cd on your computer only, not someone else’s. Then you only need your own computer drivers.
You can use “driver genius professional” to extract the drivers you need (just back-up those that are necessary),
driver genius professional
http://download.cnet.com/Driver-Genius-Professional-Edition/3000-2094_4-10238646.html
You’ll find the drivers in a subfolder of your “\documents\drivergenius\”- folder. In there, you will find the necessary .inf and .sys files.
This subfolder has to be copied to
C:\Win7PE_SE_2011_07_22\Workbench\Common\Drivers_x64\

Example :
Copy the necessary drivers (as .inf and .sys files) for your webcam in the folder :
C:\Win7PE_SE_2011_07_22\Workbench\Common\Drivers_x64\webcam\

If you’re building a 32bit iso, then you will copy 32-bit drivers to
C:\Win7PE_SE_2011_07_22\Workbench\Common\Drivers_x86\webcam

In the section “Build” in the left panel, activate the script “drivers integration”

In this script you must choose :

-enable “Load Drivers at startup”
-enable “Allow to install unsigned drivers”

for Audio:
In the left panel , under Drivers, you mark “audio”
Click the tab “script” above , right panel.

Mark : “install audio activator as backup”, to be sure.
Mark : “allow to install unsigned drivers” if you happen to use unsigned drivers
You have to put the audio drivers in two places !!!!
http://reboot.pro/11898/page__st__90

This is for a 32-bit iso :
-make a folder “Generic_audio” in “C:\Win7PE_SE_2011_07_22\Workbench\Common\Drivers_x86\’

-make a folder “AudioDriver”  in “C:\Win7PE_SE_2011_07_22\Projects\Win7PE_SE\Drivers\”

Navigate to the folder “C:\Windows\System32\DriverStore\FileRepository”
(64 bit drivers are also in this location, but they obviously have amd64 in their name (even for intel 64 BIT))
Here, you will need to find three folders :

hdaudbus.inf_x86_neutral_349139f09f579763
hdaudio.inf_x86_neutral_9781e9d72e255b2e
hdaudss.inf_x86_neutral_3f3a26225c0b8f9c

With “driver genius professional” you have already backed up your pc audio driver to :
“C:\Users\username\Documents\DriverGenius\Backup\Driver Backup _date\High Definition Audio-engine”

Now put the 4 folders :
-High Definition Audio-engine
-hdaudbus.inf_x86_neutral_349139f09f579763
-hdaudio.inf_x86_neutral_9781e9d72e255b2e
-hdaudss.inf_x86_neutral_3f3a26225c0b8f9c
in here :
“C:\Win7PE_SE_2011_07_22\Workbench\Common\Drivers_x86\generic_audio\
and in here :
“C:\Win7PE_SE_2011_07_22\Projects\Win7PE_SE\Drivers\AudioDriver\

!!! Furthermore, under “Components”, you’ll have to mark “Direct X 11” as this is also necessary to
have audio in your winpe.

Now double-click on win7PESE_builder.exe
As the source (the tab in the right pane) , you browse to the dvd-drive that contains your windows 7 install-dvd, or browse to the folder c:\sourcedvd of the extracted iso (with rtlite), or you browse to
the folder c:\expandedSetup

In the left panel of winbuilder, under WIN7PE_SE, you see “Images configuration”.
Click on “script” in the right pane ; now you see at the bottom “save / get Wim info”.
Click on it, and winbuilder will get the info of the new source.
When it’s done, at the right you’ll see the details of the install WIM.
Do this every time you change the source
On the left panel of winbuilder,under ‘Components”, you will
have to mark “MMC” for install, it is a mini-Control Panel.
When – under Components – you mark  .Net Framework,
your choice will be (in the right pane)  :”full without reference assemblies”, and instead
of running it from ram, you can run this one from CD, as it consumes a lot.
You can now mark “powershell” too, as it is dependent on .net framework.
This will make your iso rather large, and longer to load as a live-cd.

Under Components, you can mark “additional files”. You have to do this every time you start win7PE_SE-builder.exe.
First copy – with CTRL + C –  all the files, that you want to put in the  windows\system32-folder of your live-cd

Under Components, you can mark “additional files” ; then,  in the right pane,
you click on the “script”-tab, then click on “open source directories”.
Windows Explorer will open with a view on three folders : dircopyALL,
dircopyx64, and dircopy_x86.
If these files can be used in both 32-bit as well as in 64-bit, we choose
the dircopyAll-folder, and navigate to its subfolder Windows, and then
System32. With CTRL+V we paste the copied files here.
Explorer++ 64 BIT version will be copied to dircopy_x64\windows\ system32
not in the syswow64 folder.
However, if you have an exclusively 32-bit program, let’s say “explorer++.exe”, 32-bit version,
then you will have to copy that in the dircopy_x64\windows\SysWow64 folder
Syswow64 is the folder that offers support  for 32-bit programs that have to be executed on a 64-
bit system. While the windows\system32 folder ironically  is the default system folder for 64 bit programs  in a windows 7 64 bit system.

Here is the factual path to the three winbuilder folders dircopyall, dircopy_x64 and dircopy_x86  :
“C:\Win7PE_SE_2011_07_22\Workbench\Common\Win7PE_SE\AdditionalFiles\”

I tend not to include “windows explorer 8” ; instead I have included Firefox 5.0 and opera and
Iron browser (a google-chrome-like browser, which does NOT support playing
youtube movies in the live-cd (BLUE SCREEN OF DEATH), while firefox and opera do play youtube)
The scripts are here :
“C:\Win7PE_SE_2011_07_22\Projects\Win7PE_SE\Apps\Network”

Under “apps” and then “system tools” you will find a script to disable the
72-hour limit each winpe has by default, so you can use it indefinitely.

Under “shell”, you mark “explorer shell”

FORENSIC SETTINGS + FIREWALL ENABLED AT START
In the left pane, under “Finalize”, you can choose “optimizations”.
now click “Script” above in the right pane, and then you can choose “Firewall enable”,
and if you want a forensic winpe that does not mount drives, you can mark “don’t mount local harddrives”

When you have looked at all the options on the left side  (click on the + signs to see all the sub-items), in the right panel under the tab “script” you will see what they stand for (if you don’t know what they mean, leave the defaults as they are), and you can change certain settings for your winpe.

Click on the blue arrow (above  the right pane) that says “play”, and the iso will be generated automatically.

As adobe flash (which you need for youtube) tends to create problems on 64-bit-WINBUILDER-builds,
I have circumnavigated that by downloading the install-files from adobe, and installing flash
when the live cd is started.

If you want Adobe Flash player for youtube movies, I have included f.exe, flash2.exe and flash3.exe.
These should be copied to :
“C:\Win7PE_SE_2011_07_22\Workbench\Common\Win7PE_SE\AdditionalFiles\DirCopy_All\Windows\System32”

When you boot your live-cd, press “Start”, then “Run”, type :
f.exe                             and push Enter key.
Adobe will ask your permission to install, and afterwards you will be able
to play youtube-films in your winpe, even on a 64-bit winpe.

If you want the latest flash player, download the flash player for developers here (the download of 75 mb contains the files for windows)

http://kb2.adobe.com/cps/142/tn_14266.html

Rename “flashplayer10_3r181_34_win.exe” to f.exe,
flashplayer10_3r181_34_win_sa.exe  to flash2.exe
flashplayer10_3r181_34_winax.exe to flash3.exe

DO NOT INTERRUPT THE PROCES of winbuilder in the middle. everything should go smoothly, and automatically a cd is created, which you will find in the folder c:\Win7PE_SE_2011_07_22\ISO
A log is created, which is very helpful if winbuilder unexpectedly stops working.

If something unexpected happens, and the process is interrupted, normally winbuilder dismounts
everything for you.

In case that did not happen, then you can use the following command in an
administrator prompt :
Dism /Cleanup-Wim

This will clean up all leftovers from an unsuccesful dismount.

You burn the iso, and then you boot your computer (be sure to set the cd-drive as the first option in the bios).

USING THIS BOOT CD

Possible problem : numlock activated (eee pc / acer)

You want to type k, and you see  2 (or J and you see 1).
Laptops may have integrated numeric keypads on the letters
U, I,O,J,K,L,etc.
A winpe cd (that does not give me any problems on a Dell) boots
on my eee pc and on my Acer with Numlock activated, so I
can’t type  U, I, O, J, K, L.
Holding down the key FN while pushing the Num lk key does the trick;
it deactivates Numlock.
However, different laptops may use other key combinations.
Sometimes the above combination needs to be pressed down simultaneously.
Other key combinations :
press FN + Numlock key (Num lk)
press Numlock key (Num lk)
press FN + F11
press FN + F11 + Num lk
Press left Shift + Num lk
Some HP laptops need FN + F8
press Alt + Num lk on Sony Vaio
press FN + F11 + Scroll lk
FN + Scroll lk
right Shift + Num lk
FN + Shift + Num lk
FOR DELL MINI NETBOOKS that have function keys ( FN key) locked or stuck:
You need to press FN and the key that is next to your “space” key (between “space key” and “alt gr”) simultaneously!
One of these combinations will have disabled Numlock, so you can type letters again.

The original site of winbuilder :

http://www.boot-land.net/forums/index.php?showtopic=12427
http://reboot.pro/12427/

Or you can download the latest winbuilder  here :
http://w7pese.cwcodes.net/Compressed/index.php

Click on “Complete” to download the complete package.
If your winbuilder folder’s name is “c:\Win7PE_SE”, than you will have to replace the path
“C:\Win7PE_SE_2011_07_22”      in the examples above by      “c:\Win7PE_SE”

_________________________________________________________________________________________________________________________

F.EXTRACTING A BOOT.WIM FROM AN ISO WITH ULTRAISO OR POWERISO, AND EDIT THE BOOT.WIM

You have burnt the iso, and it contains no network drivers,as
yours is the latest laptop model with still exotic drivers.

You have a winpe that needs changing (always change a 64 bit winpe on a 64 bit windows)
download poweriso (you can use it indefinitely if your iso is less than 300 mb)
open winpe.iso with poweriso (or ultraiso)
navigate to /sources
rightclick on boot.wim
and choose : extract ( important : to the root of drive c:) ;  for mounting you need the path : c:\boot.wim

Now you can mount this boot.wim. Important : rightclick this boot.wim, click on “properties”, and remove mark before “read-only”
Create the folder wi in C: (c:\wi)
Then create the folder “mount” in C:\wi  , so you get this path  c:\wi\mount

to mount a boot.wim from a winpe :

dism /mount-wim /wimfile:C:\boot.wim /index:1 /mountdir:C:\wi\mount
or with the ADK for windows 8 :
Dism /mount-image /imagefile:C:\boot.wim /index:1 /mountdir:C:\wi\mount

If you want the iso to start with a Belgian azerty keyboard,
the following command will do the trick :
cd c:\program files\Windows AIK\Tools\x86

intlcfg.exe -inputlocale:nl-be -image:c:\wi\mount
(intlcfg is used in the WAIK, I’m not sure if it’s in the ADK)

OR YOU CAN DO FOLLOWING COMMANDS (this example shows
how to make a forensic cd in winpe 3.0 and winpe 3.1 (not in the latest winpe 4.0 with the ADK (assessment and deployment kit)), that does not mount any drives by default)
OR :
REG LOAD HKLM\WINFE2 c:\wi\mount\windows\system32\config\system  (mocht dit uw pad zijn)
REG ADD HKLM\WINFE2\ControlSet001\Services\MountMgr /v NoAutoMount /t REG_DWORD /d 1 /f
REG ADD HKLM\WINFE2\ControlSet001\Services\partmgr\Parameters /v SanPolicy /t REG_DWORD /d 3 /f
REG UNLOAD HKLM\WINFE2

or : with regedit, you go to the following keys and change the items :
1) HKEY_LOCAL_MACHINE\WINFE2\ControlSet001\services\partmgr\Parameters
-SanPolicy -change the DWORD value to 3

2) HKEY_LOCAL_MACHINE\WINFE2\ControlSet001\services\mountmgr
-Create a DWORD named NoAutoMount if it doesn’t exist already and change the DWORD value to 1

Close regedit

Second method to do this

Start – run
Type :
regedit
and OK

Put the cursor on :

HKEY_LOCAL_MACHINE

Choose “File”, and then “load hive”

“C:\wi\mount\Windows\System32\config”

put cursor on “SYSTEM” (‘or DEFAULT, or SOFTWARE )  and click “Open”

Now you will have to give a key name :
type :      WINFE2
Click OK

Now, in the registry, navigate to
HKEY_LOCAL_MACHINE\WINFE2\ControlSet001\Services\MountMgr
Rightclick MountMgr
Choose “new”  – “dword 32BIT value” (if your winpe is 32bit)
Type the name :
NoAutoMount
Doubleclick “NoAutoMount”, en change the value  0  to  1

Now, in the registry, navigate to
HKEY_LOCAL_MACHINE\WINFE2\ControlSet001\Services\partmgr\
Click on “Parameters”
In the right panel, choose “SanPolicy”, doubleclick it,
and change the value to   3

Click OK

In the left pane, click “WINFE2”
Choose “File”, and then “unload hive”
Click “Yes”

Close regedit

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Important : in winfe 4.0 and 5.0 with the ADK for Windows 8, the san policy settings have changed

To make the winpe a forensic one that does not mount internal hard drives
(it will mount external usb drives), you need to edit the registry :

* REG LOAD HKLM\WINFE2 C:\wi\mount\Windows\System32\config\SYSTEM * REG ADD HKLM\WINFE2\ControlSet001\Services\MountMgr /v NoAutoMount /t REG_DWORD /d 1 /f * REG ADD HKLM\WINFE2\ControlSet001\Services\partmgr\Parameters /v SanPolicy /t REG_DWORD /d 4 /f * REG ADD HKLM\WINFE2\ControlSet001\Control\FileSystem /v DisableDeleteNotification /t REG_DWORD /d 1 /f * REG UNLOAD HKLM\WINFE2

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

 

CHANGE PRELOADED KEYBOARD LAYOUT OF YOUR WINPE

When you want your winpe to have a certain keyboard layout preloaded at start,

Type this in a command prompt :
REG LOAD HKLM\WINFE2 c:\wi\mount\windows\system32\config\default
Then we will start regedit :
Start  – Run – Regedit
Open HKLM\WINFE2\Keyboard Layout\Preload.
I change the value 1 from     00000813 (Belgian point)  to   0001080c (is Belgian comma, to have a comma on the
numeric keypad of my laptop)
Close regedit
Type this in a command prompt , to unload the winpe-registry.
REG UNLOAD HKLM\WINFE2

Second method : type every one of the following sentences in a command prompt, followed by ENTER key

REG LOAD HKLM\WINFE2 C:\wi\mount\Windows\System32\config\DEFAULT
REG DELETE “HKLM\WINFE2\Keyboard Layout\Preload” /f
REG ADD “HKLM\WINFE2\Keyboard Layout\Preload” /v 1 /t REG_MULTI_SZ /D “0001080c” /f
REG UNLOAD HKLM\WINFE2

Edit this : “0001080c” if you want your winpe to start with another keyboard layout.
This value is Belgian azerty by the way.
INTEGRATE MISSING DRIVERS IN YOUR WINPE

You can  integrate missing drivers as you would in a winpe 3.0 as described in http://gverswijvel.wordpress.com.

DISM /image:c:\wi\mount /Add-Driver /driver:C:\your_DRIVERS_in_A_subfolder_OF_this_ONE\ /recurse /ForceUnsigned

Put your ati drivers in c:\yourdriversinasubfolder\ati\   ; there have to be .inf installation files.

When finished

dism /unmount-wim /mountdir:C:\wi\mount /commit
or with the ADK for windows 8 :
Dism /unmount-image /mountdir:C:\wi\mount\ /commit

This will write the changes to c:\boot.wim

Now we will have to integrate the boot.wim in the iso.

open winpe.iso with poweriso or ultraiso
navigate to /sources
choose boot.wim, and click on the red cross above to delete.

Now choose “add”, “add files”, and navigate to the file “c:\boot.wim”
Then “file”, “save as”, choose “.iso”, and you will have a fine-tuned windows live cd.

_________________________________________________________________________________

G. Make a winpe with Windows 8 WINBUILDER

Read the description in the above Winbuilder-section if you are new to this.

On a computer that has Internet access, run Windows ADK Setup from this Microsoft website.
http://go.microsoft.com/fwlink/?LinkId=232339

The easiest thing is the webinstall directly into Windows 8
Normally the only things you need are Deployment Tools and Windows Preinstallation Environment

How to create a winpe in windows 8 :
http://technet.microsoft.com/en-us/library/hh824972.aspx

Download windows 8 enterprise for use within Winbuilder Win8PE_SE
Go to this link :
http://www.youtube.com/watch?v=bQUMDLuMAhI
You have to click – under “This is free version work for 90 days only” – on “see more”  ; there you will see
the direct download link for a 32-bit or 64-bit evaluation version of windows 8 enterprise.

Homepage of Win8PE_SE, the winbuilder for Windows 8.
http://w8pese.cwcodes.net/
More info :
http://theoven.org/index.php?topic=438.0
http://theoven.org/index.php?board=29.0

Downloads page : http://w8pese.cwcodes.net/Compressed/