-
Notifications
You must be signed in to change notification settings - Fork 0
/
AD_exit hire.ps1
39 lines (32 loc) · 1.06 KB
/
AD_exit hire.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# Specify the path to the Excel file and the WorkSheet Name
$FilePath = "$env:userprofile\desktop\Exit form.xlsx"
$SheetName = "Sheet2"
# Create an Object Excel.Application using Com interface
$objExcel = New-Object -ComObject Excel.Application
# Disable the 'visible' property so the document won't open in excel
$objExcel.Visible = $false
# Open the Excel file and save it in $WorkBook
$WorkBook = $objExcel.Workbooks.Open($FilePath)
# Load the WorkSheet
$WorkSheet = $WorkBook.sheets.item($SheetName)
[pscustomobject][ordered]@{
Lastname = $WorkSheet.Range("B3").Text
Firstname = $WorkSheet.Range("B4").Text
LastWorkingdate = $WorkSheet.Range("B6").Text
PersID = $WorkSheet.Range("B10").Text
UnitManager = $WorkSheet.Range("B11").Text
ExitDateMB = $WorkSheet.Range("B14").Text
OOO = $WorkSheet.Range("B15").Text
OOOphone = $WorkSheet.Range("B16").Text
MBaccess = $WorkSheet.Range("B17").Text
}
$Lastname
$Firstname
$LastWorkingdate
$PersID
$UnitManager
$ExitDateMB
$OOO
$OOOphone
$MBaccess
$WorkBook.close()