Get-VMIntegrationService -VMName * -Name "Time Synchronization" | Disable-VMIntegrationService
Tomáš Matějíček
Poznámky bez ladu a skladu
pátek 15. května 2020
Virtual Machine time synchronization in Hyper-V
Štítky:
Hyper-V,
PowerShell
středa 19. února 2020
Oprava DFS replikace
For /f %i IN ('dsquery server -o rdn') do @echo %i && @wmic /node:"%i" /namespace:\\root\microsoftdfs path dfsrreplicatedfolderinfo get replicationgroupname,replicatedfoldername,state
The "state" values can be any of the following:
0 = Uninitialized
1 = Initialized
2 = Initial Sync
3 = Auto Recovery
4 = Normal
5 = In Error
1 = Initialized
2 = Initial Sync
3 = Auto Recovery
4 = Normal
5 = In Error
For /f %i IN ('dsquery server -o rdn') do @echo %i && @wmic /node:"%i" /namespace:\\root\microsoftdfs path DfsrMachineConfig get MaxOfflineTimeInDays
For /f %i IN ('dsquery server -o rdn') do @echo %i && @wmic /node:"%i" /namespace:\\root\microsoftdfs path DfsrMachineConfig set MaxOfflineTimeInDays=300
Zdroj: https://support.microsoft.com/en-us/help/2958414/dfs-replication-how-to-troubleshoot-missing-sysvol-and-netlogon-shares
středa 7. listopadu 2018
Transfer FSMO rolí
Repadmin /syncall /e /d /A /P /q
repadmin /replsum /bysrc /bydest /sort:delta
Move-ADDirectoryServerOperationMasterRole -Identity NEW-PDC01 -OperationMasterRole SchemaMaster, DomainNamingMaster, PDCEmulator, RIDMaster, InfrastructureMaster
repadmin /replsum /bysrc /bydest /sort:delta
Move-ADDirectoryServerOperationMasterRole -Identity NEW-PDC01 -OperationMasterRole SchemaMaster, DomainNamingMaster, PDCEmulator, RIDMaster, InfrastructureMaster
středa 30. května 2018
Zmenšení velikosti VHD
diskpart
select vdisk file="d:\store\vdisk.vhdx"
attach vdisk
list vol
sel vol X
shrink querymax
shrink desired=262144
detach vdisk
exit
Resize-VHD -Path d:\store\vdisk.vhdx -ToMinimumSize
select vdisk file="d:\store\vdisk.vhdx"
attach vdisk
list vol
sel vol X
shrink querymax
shrink desired=262144
detach vdisk
exit
Resize-VHD -Path d:\store\vdisk.vhdx -ToMinimumSize
Štítky:
Hyper-V
středa 10. ledna 2018
Úplná obnova serveru na stejný nebo úplně jiný hardware
A server that is not a domain controller has gone for a burton,
the whole server is a melted heap, or is gently rocking back and forth in the
corner muttering about its childhood. You need to restore the whole server. I’m
assuming at this point you have a replacement server you can use, this might be
the same hardware with a component replaced (similar), or a brand new server
(dissimilar).
These instructions have been tested on a Dell PowerEdge R410
Server with a H200 RAID controller and a Dell PowerEdge R410 Server with a
SAS6i RAID controller, both running Microsoft Windows 2008 R2, although the
procedure is the same for Microsoft Windows 2012 server.
1. Hook up the server, connect a monitor, keyboard and mouse (or
use a KVM), start the server up and insert the Windows 2008 R2 Disc (which
should have the same service pack slipstreamed in as the server you are
restoring.)
2. If you need any RAID or
Network card drivers you should have these on a USB memory stick, you may or
may not need these depending on if your server has a generic Windows driver
support or not. Either way prepare this if you need it.
3. Power up the server, ensure
it boots up and configure the RAID to how you want it.
NOTE: The hard disk space on the server you are
recovering to must be the same size or larger than that from which you took the
backup. I.e. if you had a 100GB server, you can restore to a server with 100GB
disk space or larger, you can’t restore a server with 60GB disk space.
4. Boot off the Microsoft
Windows 2008 R2 DVD you have shoved in the drive. Wait for it to get to the
Windows Setup screen.
5. Once it’s booted,
select the “Time and Currency Format” as English (United Kingdom) and the
“Keyboard” as UK and click on next.
6. Rather than clicking on
“Install Now”, you should click on the “Repair your Computer” button in the
bottom left of the screen.
7. Select “Restore your
computer using a system image that you created earlier” and click on “Next
>”
NOTE: If you need to load a driver you should do it
now, by clicking on “Load Drivers” and shoving in the USB memory stick.
8. When prompted click on
“Select a System Image” and click on “Next >” you should then see the images
on the USB hard disk, click the one you want, then click on “Next >.”
9. Now you’ll see the
recovery points (if there’s more than one) for your server, with the times. In
our example, we have two of the buggers. Let’s use the oldest one in this case,
so click on the one you want, then click “Next >.”
10. Now you’re prompted to
“Format and repartition disks”, you should do this unless you really have a
reason not to. This will wipe the kack of the server so your restore will be as
clean as possible. If say you had data on a separate disk you don’t want wiping
click on “Exclude disks..” and tick the drive you want excluding.
11. You might want to add
extra drivers, now is the time to do this, click on “Install Drivers…” and
select the driver files from a USB memory stick. “Advanced…” allows you to
specify extra options, unless you have a reason to you don’t need to change
these.
12. Click on “Next >”
then review you have the correct backup selected, then click on “Finish” to
start the ball rolling. Confirm by clicking on “Yes” and your server will start
to restore. It will reboot when it’s all done.
Time for a cuppa!
13. Once the restoration
has been completed, the server will reboot itself, and if all is well will boot
up into your newly restored Windows image.
Oh, Balls!
Blue Screen of Death STOP: 0x0000007B (0xFFFFF880009A9928,0xFFFFFFFFC0000034,0x00000000000000000, 0x00000000000000000) |
If it doesn’t come up, you
should boot off the Windows 2008 R2 disc instead, but if you do this you’ll
need to wait until you get to the Windows setup screen, and then press Shift
F10 to get a command prompt, then carry on as below.
15. Select “United
Kingdom” as the keyboard method, then click on “Next >” you’ll then be
prompted for the Administrator password of the server. Now on a member server
this is just the local administrator account password, on a domain controller,
this is the restore mode password. Enter it and click on “Next >” to
continue.
16. Click on “Command
Prompt” from the set of three options.
A
quick aside: To disable the auto-reboot function so you can have a good
butchers at the BSOD, you need to open the registry, to do this perform
these steps: 1. Open Command Prompt. 2. regedt32 3. Highlight HKEY_LOCAL_MACHINE, File>Load Hive>[restored volume]:\Windows\System32\Config\SYSTEM ->Open->Key Name = Restored_HKLM>OK. 4. Expand Restored_HKLM\ControlSet001\Control\CrashControl and ensure the “AutoReboot” DWORD value has been set to 0 (setting it to 0 means autoreboot is turned off) then click OK. 5. Click on the “Restored_HKLM” hive and then select File>Unload Hive to disconnect from the registry. 6. Reboot the server and you’ll see the BSOD in all its shitty glory. |
17. Now perform the
following steps within the command prompt:
1. regedt32 2. Highlight HKEY_LOCAL_MACHINE, File>Load Hive>[restored volume]:\Windows\System32\Config\SYSTEM>Open>Key Name = Restored_HKLM>OK. 3. Expand Restored_HKLM\ControlSet001\services and ensure the following keys “Start” are set to 0 (zero) instead of whatever value they currently have. You are basically turning them all on by setting it to 0 (zero.) aliide (changed), amdide (changed), atapi, cmdide (changed), iastorv (changed), intelide (changed), msahci (changed), pciide, viaide (changed), LSI_SAS (changed). If restored to a (VMWare) VM then ensure intelide>Start = 0 and LSI_SAS>Start = 0; msahci>Start = 3 and pciide>Start = 3 NB: I have only tested this with VMWare VMs (Player/Workstation and vSphere) but will likely translate across to Microsoft (e.g. HyperV) VMs. The LSI_SAS value is definitely required, I couldn't boot in a VM until this was changed to 0. Or if restoring to a physical machine with native HDD controller then ensure msahci>Start = 0 and pciide>Start = 0; intelide>Start = 3 and LSI_SAS>Start = 3 4. Highlight Restored_HKLM and then File>Unload Hive. 5. Close windows and restart. |
This is discussed here in more detail
Note: Turning them all on, isn’t the best thing, but it will get
the server up, you should then experiment by turning each one off one by one
(i.e. setting it to 3) until you stop the server booting, we don’t want stuff
running that we don’t actually use.
18. Okay bitching, we are
cooking on gas now! We have it booting up.
19. The server is up and
running, you should now login to ensure all is well. You’ll need to logon
locally, because the network card settings may have gone walkabout and you’ll
need to reconfigure them.
20. Go to the command prompt.
1. Type: ” SET DEVMGR_SHOW_NONPRESENT_DEVICES=1 “ and press 2. Type: ” Start devmgmt.msc ” and press 3. In the Device Manager go to View and click on ” Show Hidden Devices “ 4. Navigate to the Network Adapters and expand it, there should be your old NIC 5. Select and delete. 6. Remove all the NICs (even the live ones), then rescan for new devices. |
By
doing the above you'll remove the old NICs from the image, these will
have been from the server from which you imaged from. If of course you
are restoring onto the identical hardware this is unlikely to be the
case. its good to get rid of these ghost adapters because they can cause
problems.
21. Now the devices will
have re-appeared, you just need to configure their network settings as per the
old server configuration. Disable any unused NICs to avoid weird-ness.
22. Reboot the server to
confirm, and that’s it, you should have your server working again. It is
advised that you check everything and then troubleshoot any errors, but as this
is an image of the server, then these should be minimal unless of course you
are restoring a domain controller, in which case you have more to do.
NOTE: if this server
is staying in production, don’t forget to turn off the unneeded services from
step 17. This is trial and error.
Štítky:
Windows Server,
Windows Server 2008 R2
středa 15. listopadu 2017
Řešení duplicity při synchronizaci AD s Azure AD
$AD_Username = "uzivatelske.jmeno"; $DELETE_UPN = "uzivatelske.jmeno@domena.cz"; $Azure_UPN = "email@domena.cz"; $guid = (get-Aduser $AD_Username).ObjectGuid $immutableID = [System.Convert]::ToBase64String($guid.tobytearray()) Install-Module MSOnline Import-Module MSOnline Connect-MSOLService $DELETE_UPN
Get-MsolUser -UserPrincipalName $DELETE_UPN | Remove-MsolUser Remove-MSOLuser -UserPrincipalName $DELETE_UPN -RemoveFromRecycleBin Set-MSOLuser -UserPrincipalName $Azure_UPN -ImmutableID $immutableID Start-ADSyncSyncCycle -PolicyType Delta
Štítky:
AD,
Azure,
Office 365
pátek 31. března 2017
Vyčištění disku na serveru bez instalace Desktop Experience
copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.0.6001.18000_none_c962d1e515e94269\cleanmgr.exe C:\Windows\System32\ copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.0.6001.18000_cs-cz_769ec0156a09da94\cleanmgr.exe.mui C:\Windows\System32\cs-CZ\ copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.1.7600.16385_none_c9392808773cd7da\cleanmgr.exe C:\Windows\System32 copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.1.7600.16385_cs-cz_76751638cb5d7005\cleanmgr.exe.mui C:\Windows\System32\cs-CZ\ copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr_31bf3856ad364e35_6.2.9200.16384_none_c60dddc5e750072a\cleanmgr.exe C:\Windows\System32 copy C:\Windows\winsxs\amd64_microsoft-windows-cleanmgr.resources_31bf3856ad364e35_6.2.9200.16384_cs-cz_7349cbf63b709f55\cleanmgr.exe.mui C:\Windows\System32\cs-CZ\
Přihlásit se k odběru:
Příspěvky (Atom)