Functions/Public/New-DMISQLiteDB.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
<#
.Synopsis
   Creates a new instance of a SQLite database locally to store the DMI information in. This should be created automatically by the module.
.DESCRIPTION
   Creates a new instance of a SQLite database locally to store the DMI information in. This should be created automatically by the module.
.EXAMPLE
   PS C:\> New-DMISQLiteDB
#>

function New-DMISQLiteDB {
    [CmdletBinding()]
    param (
        
    )
    
    begin {
        
    }
    
    process {
        if(Test-Path -Path $Script:SQLiteDBPath){
            Write-Verbose -Message "Existing database found. Removing $($Script:SQLiteDBPath)"
            Remove-Item -Path $Script:SQLiteDBPath -Force
        }
        
        [String]$Query = "CREATE TABLE DMI (
            Banner_Org VARCHAR(14) PRIMARY KEY,
            Legacy_Code TEXT,
            Deptname TEXT,
            deptFullName TEXT,
            deptDisplayName TEXT,
            deptDisplayName2 TEXT,
            deptDisplayName3 TEXT,
            deptDescription TEXT,
            Name TEXT,
            Address TEXT,
            Address2 TEXT,
            Mailcode TEXT,
            buildingCode TEXT,
            city TEXT,
            state TEXT,
            zip TEXT,
            areaCode TEXT,
            Phone TEXT,
            NetId TEXT,
            EndUserITSupportNetId TEXT,
            CIP TEXT,
            Comments TEXT,
            DeptType TEXT,
            Dean TEXT,
            Duplicate TEXT,
            Active TEXT,
            Campus TEXT,
            College TEXT,
            CollegeName TEXT,
            AdminRollup TEXT,
            School TEXT,
            Dept TEXT,
            URL TEXT,
            directoryDisplay TEXT
            )"


            Invoke-SqliteQuery -Query $Query -DataSource $Script:SQLiteDBPath
    }
    
    end {
        
    }
}