165 Commits

Author SHA1 Message Date
Matthew Oliver
51d92a575e Add a function to allow setting/reading REG_MULTI_SZ
PiperOrigin-RevId: 828113563
2025-11-04 13:35:06 -08:00
Matthew Oliver
ce1da7dacb This should be cast as 2 separate items.
PiperOrigin-RevId: 828028528
2025-11-04 10:18:13 -08:00
Matthew Oliver
b9a5d298a2 Allow users to specify repo priority
PiperOrigin-RevId: 827779690
2025-11-03 21:35:08 -08:00
Glazier Bot
4e47614d64 Improve window handle lookup to work with Windows Terminal
PiperOrigin-RevId: 785826252
2025-07-22 06:12:25 -07:00
Matthew Oliver
0ed520ba4a * Add helper functions for;
+ MSFT_NetIPAddress
   + MSFT_NetAdapter
     + Disable, Enable, Rename support
   + Win32_NetworkAdapterConfiguration
 * Add unit tests for all of the above.

PiperOrigin-RevId: 785509372
2025-07-21 11:24:33 -07:00
Matthew Oliver
3b3203f20e Add a function to lookup nic by mac address and unit tests for NetworkAdapterPropertiesByMac and NetworkAdapterProperties
PiperOrigin-RevId: 784414281
2025-07-17 20:22:52 -07:00
Glazier Bot
0a1d989d31 Add domain joined function.
PiperOrigin-RevId: 778112582
2025-07-01 11:02:28 -07:00
Matthew Oliver
c0856432f2 Create helper functions for common network tasks: Get local NIC info, set IP, DNS and forward routes (e.g. default gateway)
PiperOrigin-RevId: 776369090
2025-06-26 18:56:33 -07:00
Glazier Bot
7bdde3becf Add function to set console window position. Note that this will not work with windows terminal, it will only work with powershell or cmd.
PiperOrigin-RevId: 766939684
2025-06-03 20:23:59 -07:00
Glazier Bot
311347217c Add ability to delete registry keys recursively.
PiperOrigin-RevId: 761584506
2025-05-21 10:47:55 -07:00
Matthew Oliver
11bfd58689 Add a function to set binary reg values
PiperOrigin-RevId: 723711465
2025-02-05 17:24:49 -08:00
Matthew Oliver
c90d5bf10f Set Windows build flag
PiperOrigin-RevId: 711397777
2025-01-02 05:33:40 -08:00
Glazier Bot
2385c6d8d8 Fix a panic when we call close before wmiSVC is set.
PiperOrigin-RevId: 691499479
2024-10-30 11:46:59 -07:00
Glazier Bot
b971e29070 Add StartServiceWithVerify to helpers_windows.go
This function attempts to start a local system service and verifies the service is running with a 60 second timeout default, or optional param. Additionally adds param to RestartServiceWithVerify.

PiperOrigin-RevId: 691141799
2024-10-29 13:32:03 -07:00
Glazier Bot
e81f0a0d6e Make it so that if a drive that auto formats to MBR is inserted, we convert it to GPT.
PiperOrigin-RevId: 688941699
2024-10-23 06:33:33 -07:00
Glazier Bot
3b1370ff1b Add RestartServiceWithVerify to helpers_windows.go
PiperOrigin-RevId: 684855644
2024-10-11 09:04:12 -07:00
Matthew Oliver
a5e7c6ee0a Internal changes
PiperOrigin-RevId: 681924366
2024-10-03 10:03:49 -07:00
Glazier Bot
fb3efc2e45 Revert previous change and allow function callers to define their own verifier
PiperOrigin-RevId: 676493857
2024-09-19 11:26:39 -07:00
Glazier Bot
d42ab07794 Add exit code 1 to googet install success codes.
Googet installed returns exit code 1 if no packages are installed.

PiperOrigin-RevId: 676421174
2024-09-19 08:18:34 -07:00
Glazier Bot
e19acf25b1 Swap from the ConvertStyle method during disk initialization to calling the Initialize method and make it so that disks that automatically get initialized during wipe (most flash drives) don't throw an error.
This will make drives that would previously fail now work with fresnel.

PiperOrigin-RevId: 675343175
2024-09-16 17:03:01 -07:00
Matt LaPlante
ecffa77d6f Move Exec helpers to cross-platform build.
These are not using Windows-specific dependencies, and as such should theoretically be viable on any platform. The only change at present is to allow file extensions other than .bat/.exe.

PiperOrigin-RevId: 648830301
2024-07-02 13:45:48 -07:00
Brian Garber
35e21f9476 Internal Change
PiperOrigin-RevId: 635487046
2024-05-20 09:58:16 -07:00
Glazier Bot
e92ec5e458 Use strings.EqualFold to compare manufacturer.
EqualFold is a more idiomatic way for case-insensitive string comparison.

PiperOrigin-RevId: 631493115
2024-05-07 11:33:47 -07:00
Matthew Oliver
e2cb03c942 If Lenovo return SystemFamily instead since its more human readable (e.g. ThinkPad P1 Gen 6) rather than 21FWS4...
PiperOrigin-RevId: 622276025
2024-04-05 14:02:54 -07:00
Copybara-Service
10eae9a52d Merge pull request #722 from jfut:evtexportlog
PiperOrigin-RevId: 596592991
2024-01-08 07:55:33 -08:00
Jun Futagawa
e75d8b2da9 Add support for EvtExportLog 2023-12-29 16:03:04 +09:00
Dan Tsekhanskiy
7f75f30d4b refactor: Export RegStagesRoot variable
PiperOrigin-RevId: 530586593
2023-05-09 06:02:27 -07:00
Dan Tsekhanskiy
fa71b73c97 Internal Change
PiperOrigin-RevId: 528743733
2023-05-02 04:37:55 -07:00
Dan Tsekhanskiy
b5fbd4ac0a feat: Add functions to set stages in the registry
PiperOrigin-RevId: 527343640
2023-04-26 12:35:58 -07:00
Glazier Bot
a5268e4ee8 Add support for the dbonly flag in googet install
PiperOrigin-RevId: 520666186
2023-03-30 09:50:38 -07:00
Matt LaPlante
327255c518 Allow ExecError to wrap other errors. Wrap ErrTimeout during timeout failures.
PiperOrigin-RevId: 507456687
2023-02-06 05:54:00 -08:00
Matthew Oliver
a65510befb * Add task fetch
PiperOrigin-RevId: 506265197
2023-02-01 03:22:12 -08:00
Matt LaPlante
af51de296f Add task starting.
PiperOrigin-RevId: 504857998
2023-01-26 09:07:09 -08:00
Matt LaPlante
2c148e9742 Migrating Glazier logging from logger to deck.
PiperOrigin-RevId: 495869797
2022-12-16 07:32:59 -08:00
Matthew Oliver
8afb0f0cd5 Add Googet Clean Func
PiperOrigin-RevId: 492207448
2022-12-01 08:48:42 -08:00
Dan Tsekhanskiy
13b586ad08 chore: Log the googet command that is being executed
Output looks like this: `Executing: \googet.exe [-noconfirm install --sources http://repo/manifest/url pkg-one]`

PiperOrigin-RevId: 484043375
2022-10-26 12:41:50 -07:00
Matthew Oliver
b6d25efffd * check whether the user has write access on removable devices based on defined policy, if they do not point them towards helpdesk.
PiperOrigin-RevId: 470205293
2022-08-26 03:32:03 -07:00
Matthew Oliver
b20e1fe5ff cmd.Wait() for a non 0 exit code is filled with metadata (it's assuming any non 0 exit code is bad), by pinning verify on this being nil means we are doing the same
```
The returned error is nil if the command runs, has no problems copying stdin, stdout, and stderr, and exits with a zero exit status.
```

Do some additional parsing of res.ExitErr first to not bail on verification if ExitErr contains a "bad" exit status and let the additional checks determine if the run was bad.

PiperOrigin-RevId: 463916936
2022-07-28 13:49:05 -07:00
Matthew Oliver
e23dcd2b98 * Add a process timer to helpers.exec
* example;

```
  out, err := helpers.exec(foo)
  ....
  fmt.Printf("process completed after %v minutes", out.ProcessTimer.Minutes())
```

PiperOrigin-RevId: 461168072
2022-07-15 04:00:08 -07:00
Matt LaPlante
91d189d73e Have stopService check service state before attempting to control it.
Control returns an error if the service is already stopped, so this avoids an error in situations where the stop is effectively already accomplished.

PiperOrigin-RevId: 437807711
2022-03-28 11:18:03 -07:00
Matt LaPlante
666bf0a4e4 Add the StringInSlice helper from cablib.
PiperOrigin-RevId: 437780428
2022-03-28 09:38:05 -07:00
Matt LaPlante
914b189bff Split helpers tests between windows-specific and generic.
PiperOrigin-RevId: 437767984
2022-03-28 08:43:58 -07:00
Matt LaPlante
25552b8222 Add support for the listrepos command.
PiperOrigin-RevId: 437764791
2022-03-28 08:27:32 -07:00
Matt LaPlante
4a7d06f933 Add a non-Windows stub to the power package.
PiperOrigin-RevId: 437089907
2022-03-24 14:40:13 -07:00
Matthew Oliver
58e4ddf821 Extend helpers with a function that can manage Service Startup Types
PiperOrigin-RevId: 431940024
2022-03-02 08:00:10 -08:00
Matt LaPlante
9d92df0df7 Allow the helpers library to be imported by projects building against non-Windows.
PiperOrigin-RevId: 430766541
2022-02-24 12:30:32 -08:00
Copybara-Service
8a7f3dacb8 Merge pull request #460 from lippertmarkus:fix-session-reloading
PiperOrigin-RevId: 420841904
2022-01-10 13:28:23 -08:00
Markus Lippert
1c56e1c323 no error in warningf allowed 2022-01-07 21:19:18 +01:00
Markus Lippert
59a72b987d add logging, handle session closing errors on reloading 2022-01-06 07:38:54 +01:00
Matthew Oliver
27694aeee4 Add a table for Operational Status` ref: https://docs.microsoft.com/en-us/previous-versions/windows/desktop/stormgmt/msft-partition
PiperOrigin-RevId: 419081213
2021-12-31 03:41:35 -08:00