forked from insystemsco/Office365
-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile.ps1
63 lines (54 loc) · 2.53 KB
/
profile.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
#Put this file under your C:\users\username\my documents\windowspowershell\ folder
function prompt
{
# New nice WindowTitle
$Host.UI.RawUI.WindowTitle = "PowerShell v" + (get-host).Version.Major + "." + (get-host).Version.Minor + " (" + $pwd.Provider.Name + ") " + $pwd.Path
# Admin ?
if( (
New-Object Security.Principal.WindowsPrincipal (
[Security.Principal.WindowsIdentity]::GetCurrent())
).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator))
{
# Admin-mark in WindowTitle
$Host.UI.RawUI.WindowTitle = "[Admin] " + $Host.UI.RawUI.WindowTitle
# Admin-mark on prompt
Write-Host "[" -nonewline -foregroundcolor DarkGray
Write-Host "Admin" -nonewline -foregroundcolor Red
Write-Host "] " -nonewline -foregroundcolor DarkGray
}
# Show providername if you are outside FileSystem
if ($pwd.Provider.Name -ne "FileSystem") {
Write-Host "[" -nonewline -foregroundcolor DarkGray
Write-Host $pwd.Provider.Name -nonewline -foregroundcolor Gray
Write-Host "] " -nonewline -foregroundcolor DarkGray
}
# Split path and write \ in a gray
$pwd.Path.Split("\") | foreach {
Write-Host $_ -nonewline -foregroundcolor Yellow
Write-Host "\" -nonewline -foregroundcolor Gray
}
# Backspace last \ and write >
Write-Host "`b>" -nonewline -foregroundcolor Gray
return " "
}
function Out-vCard {
$input | ForEach-Object {
$filename = "c:\users\username\desktop\" + $_.Name + ".vcf"
Remove-Item $filename -ErrorAction SilentlyContinue
add-content -path $filename "BEGIN:VCARD"
add-content -path $filename "VERSION:2.1"
add-content -path $filename ("N:" + "" + $_.Surname + ";" + $_.GivenName)
add-content -path $filename ("FN:" + $_.Name)
add-content -path $filename ("EMAIL:" + $_.Mail)
add-content -path $filename ("ORG:" + $_.Company)
add-content -path $filename ("TITLE:" + $_.Title)
add-content -path $filename ("TEL;WORK;VOICE:" + $_.PhoneNumber)
add-content -path $filename ("TEL;HOME;VOICE:" + $_.HomePhone)
add-content -path $filename ("TEL;CELL;VOICE:" + $_.MobilePhone)
add-content -path $filename ("TEL;WORK;FAX:" + $_.Fax)
add-content -path $filename ("ADR;WORK;PREF:" + ";;" + $_.StreetAddress + ";" + $_.PostalCode + " " + $_.City + ";" + $_.co + ";;" + $_.Country)
add-content -path $filename ("URL;WORK:" + $_.WebPage)
add-content -path $filename ("EMAIL;PREF;INTERNET:" + $_.Email)
add-content -path $filename "END:VCARD"
}
}