728x90

Function Copy-WithProgress
{
    [CmdletBinding()]
    Param
    (
        [Parameter(Mandatory=$true,
            ValueFromPipelineByPropertyName=$true,
            Position=0)]
        $Source,
        [Parameter(Mandatory=$true,
            ValueFromPipelineByPropertyName=$true,
            Position=0)]
        $Destination
    )

    $Source=$Source.tolower()
#    $Filelist=Get-Childitem "$Source" –Recurse   -- 대상 폴더안의 파일 및 폴더 전체를 리스트함.
    $Filelist=Get-Childitem 파일명
    $Total=$Filelist.count
    $Position=0


    foreach ($File in $Filelist)
    {
        $Filename=$File.Fullname.tolower().replace($Source,'')
        #$Filename= 파일명
        $DestinationFile=($Destination+$Filename)
        Write-Progress -Activity "Copying data from '$source' to '$Destination'" -Status "Copying File $Filename" -PercentComplete (($Position/$total)*100)
        Copy-Item $File.FullName -Destination $DestinationFile
        $Position++
    }
}

$src="c:\temp"
$dest="C:\Temp\download"

Copy-WithProgress -Source $src -Destination $dest

#복사 완료 후 제거 
Remove-Item c:\temp\sw_dvd5_office_professional_plus_2016_64bit_korean_mlf.iso -Force  

728x90
728x90

MSSQL에서는 날짜를 여러가지형태로 가공할 수 있는 함수들을 많이 제공하고 있습니다.

이번 포스팅에서는 대표적인 날짜함수(GETDATE,DATEADD,DATEPART,DATEDIFF)의 사용법에 대해서 알아보도록 하겠습니다.

 

 

GETDATE 

GETDATE함수는 현재 컴퓨터에 설정되어있는 시스템 시간을 불러와주는 함수입니다.

2018-03-31 오전 01:40:30 

위와같이 GETDATE()함수는 년월일은 물론이거니와 분,초 까지도 구해줍니다.

하지만 모든 사용자들이 위와같은 형식으로 사용하지는 않겠죠.

여기서 우리는 우리가 표시할 시간이나 날짜만 적절히 뽑아 올 수도 있고

날짜 형태를 바꿔서 출력할수도 있습니다.

 

사용법

--현재 날짜 출력--

SELECT GETDATE() AS 시스템일자

--현재 날짜의 연,월,일 출력--

SELECT YEAR(GETDATE()) AS 년,

MONTH(GETDATE()) AS 월,

DAY(GETDATE()) AS

출력 포맷 변경

--YYYY/MM/DD--

Select Convert(varchar(10),Getdate(),111)

--YYYYMMDD--

Select Convert(varchar(10),Getdate(),112)

--HH:MM:SS--

Select Convert(varchar(8),Getdate(),108)

--HH:MM:SS:mmm--

Select Convert(varchar(12),Getdate(),114)

--HHMMSS--

Select Replace(Convert(varchar(8),Getdate(),108),':','')

--HHMMSSmmm--

Select Replace(Convert(varchar(12),Getdate(),114),':','')

--YYYY/MM/DD HH:MM:SS--

Select Replace(Convert(varchar(30),Getdate(),120),'-','/')

--YYYY/MM/DD HH:MM:SS--

Select Replace(Convert(varchar(30),Getdate(),121),'-','/')

--YYYY/MM/DD HH:MM:SS--

Select Convert(varchar(10),Getdate(),111) + Space(1) + Convert(varchar(8),Getdate(),108)

--YYYYMMDDHHMMSS--

Select Convert(varchar(10),Getdate(),112) + Replace(Convert(varchar(8),Getdate(),108),':','')

 

DATEADD 

DATEADD함수는 날짜에 원하는 일수를 더해서 출력해주는 함수입니다.

100일뒤에는 몇일이다 이런것은 쉽게 계산하기 힘든데

DATEADD함수를 쓰면 이런것들을 편리하게 계산할 수 있습니다.

이 함수를 좀 더 응용하면 100일 뒤에는 무슨 요일이다 이렇게도 응용가능합니다.

 

사용법

--2개월 후 출력--

SELECT DATEADD(MM,2,GETDATE()) AS '2개월후'

--30일전 출력--

SELECT CONVERT(NVARCHAR(8),DATEADD(DAY,-30,'20180124'),112)AS '30일전'

--1달 뒤 요일계산

SELECT DATENAME(WEEKDAY,DATEADD(MM,1,GETDATE())) AS'요일계산'

 

 

DATEPART 

DATEPART함수는 날짜에서 지정한 날짜형식의 부분만 출력해주는 함수입니다.

아주 다양하게 활용이 가능한 함수입니다.

 

사용법

--현재 년도 구하기

SELECT DATEPART(YEAR,GETDATE());

--현재 월 구하기--

SELECT DATEPART(MONTH,GETDATE())

--현재 일 구하기--

SELECT DATEPART(DAY,GETDATE())

--현재 분기 구하기--

SELECT DATEPART(QQ,GETDATE())

--올해의 몇번째 날인지 구하기--

SELECT DATEPART(DAYOFYEAR,GETDATE())

--올해의 몇째 주인지 구하기--

SELECT DATEPART(WEEK,GETDATE())

--이번주의 몇번째 날인지 구하기--

SELECT DATEPART(WEEKDAY,GETDATE())

--오늘이 무슨요일인지 구하기--

SELECT

CASE DATEPART(WEEKDAY, GETDATE())

WHEN '1' THEN '일요일'

WHEN '2' THEN '월요일'

WHEN '3' THEN '화요일'

WHEN '4' THEN '수요일'

WHEN '5' THEN '목요일'

WHEN '6' THEN '금요일'

ELSE '토요일'

END AS '요일'

 

DATEDIFF 

DATEDIFF함수는 지정한 두 날자간의 간격을 계산해주는 함수입니다.

정해준 날짜형식에 맞춰 리턴값이 다르므로 적절하게 잘 설정해주셔야 합니다.

 

사용법

--지정일과의 현재와의 년도차이 계산--

SELECT DATEDIFF(YY,'2000-01-01',GETDATE())

--지정일과의 현재와의 월차이 계산--

SELECT DATEDIFF(MM,'2000-01-01',GETDATE())

--지정일과 현재와의 일차이 계산--

SELECT DATEDIFF(DD,'2000-01-01',GETDATE())

 

 

 

728x90
728x90

데이터베이스를 사용하다보면 테이블안에있는 데이터의 특정 문자들만 치환 해줘야 하는 일이 생깁니다. 이번 포스팅에서는 특정 문자열을 바꿔주는 REPLACE함수와 STUFF함수에 대해서 알아보도록 하겠습니다.

 

REPLACE

지정된 문자열 값을 특정 문자열로 바꿔주는 함수입니다.

 

사용법

--문법--

REPLACE('문자열','치환예정문자','치환할문자')

--예시--

REPLACE('ABCDEFG','DEF','XXX')

예제

--MY_TABLE에서 이름(NM_KOR)을 이씨를 김씨으로 바꿔서 출력--

SELECT REPLACE(NM_KOR,'이','김')AS 사원명 FROM MY_TABLE

 

STUFF

지정된 문자열의 시작위치와 크기를 지정하여 원하는 문자로 치환하는 함수입니다.

 

사용법

--문법--

STUFF('문자열','시작위치','크기','치환할문자')

--예시--

STUFF('ABCDEFG',2,3,'XXX')

예제

--MY_TABLE에서 이름(NM_KOR)칼럼의 이순신을 이성계로 바꿔서 출력--

SELECT STUFF(NM_KOR,2,2,'성계')AS 사원명 FROM MY_TABLE

728x90
728x90

데이터베이스를 사용하다보면 테이블안에있는 데이터의 특정 문자들만 치환 해줘야 하는 일이 생깁니다. 이번 포스팅에서는 특정 문자열을 바꿔주는 REPLACE함수와 STUFF함수에 대해서 알아보도록 하겠습니다.

 

REPLACE

지정된 문자열 값을 특정 문자열로 바꿔주는 함수입니다.

 

사용법

--문법--

REPLACE('문자열','치환예정문자','치환할문자')

--예시--

REPLACE('ABCDEFG','DEF','XXX')

예제

--MY_TABLE에서 이름(NM_KOR)을 이씨를 김씨으로 바꿔서 출력--

SELECT REPLACE(NM_KOR,'이','김')AS 사원명 FROM MY_TABLE

 

STUFF

지정된 문자열의 시작위치와 크기를 지정하여 원하는 문자로 치환하는 함수입니다.

 

사용법

--문법--

STUFF('문자열','시작위치','크기','치환할문자')

--예시--

STUFF('ABCDEFG',2,3,'XXX')

예제

--MY_TABLE에서 이름(NM_KOR)칼럼의 이순신을 이성계로 바꿔서 출력--

SELECT STUFF(NM_KOR,2,2,'성계')AS 사원명 FROM MY_TABLE

728x90
728x90

LEFT 

Left함수는 문자열을 받아서 왼쪽부터 원하는 길이만큼 자르는 함수이며

주민등록번호만으로도 생년월일을 구하거나 이름을 잘라서 성만 출력하는 등

사용법

--문법--

LEFT(문자열,길이)

--예시--

LEFT(NAME,2)

예제

--테이블(MY_TABLE)에서 이름(Name)을 잘라 성만 출력--

SELECT LEFT(Name,1) AS 이름 FROM MY_TABLE

 

RIGHT

RIGHT함수는 LEFT함수와 기능은 같지만 방향만 다른 함수입니다.

RIGHT함수는 문자열을 받아서 오른쪽부터 원하는 길이만큼 자르는 함수이며

LEFT함수와 마찬가지로 다양하게 사용이 가능합니다.

 

사용법

--문법--

RIGHT(문자열,길이)

--예시--

RIGHT(NAME,3)

예제

--테이블(MY_TABLE)에서 이름(NM_KOR)을 잘라 이름만 출력--

SELECT RIGHT(Name,2) AS 이름 FROM MY_TABLE

 

 

SUBSTRING

SubString함수의 기능은 문자열을 받아서 일정한 영역만큼 잘라낸 후 리턴하는 기능을 가지고 있습니다.

주민등록번호만으로도 성별을 잘라서 활용하거나 날짜를 잘라서 월별로 그룹을 만드는등

다양한 방법으로 활용 가능합니다.

정말 많이쓰이는 문자열함수 중 하나입니다.

 

사용법

--문법--

SUBSTRING(문자열,시작자리번호,자를문자수)

--예시--

SUBSTRING(resident_number,0,6)

예제

--테이블(MY_TABLE)에서 이름 2번째자리에서 2개만 잘라서 출력--

SELECT SUBSTRING(Name,2,2) AS 이름 FROM MY_TABLE

--테이블(MY_TABLE)에서 날짜(DT)를 잘라 0000년00월00일 형식으로 만들기--

SELECT SUBSTRING(DT,1,4)+'년'+SUBSTRING(DT,5,2)+'월'+SUBSTRING(DT,7,2)+'일' AS일자 FROM MY_TABLE

 

 

728x90
728x90

select d.name, d.dbid, spid, login_time, nt_domain, nt_username, loginame
from sysprocesses p
inner join sysdatabases d on p.dbid = d.dbid
where d.name = 'DB_Name'

 

or

 

exec sp_who2

kill spid

alter database DB_Name set multi_user;

alter database DB_Name set sigle_user;

728x90
728x90

$user = Import-csv C:\temp\sid.csv

$user | foreach{Get-ADUser -Identity $_.samaccountname -Properties * | Select-Object samaccountname, SID} | Export-Csv C:\temp\s_sid.csv -Delimiter "|" -Encoding Unicode -NoTypeInformation

 

or 

 

dsquery * -filter “&(objectcategory=user)(samaccountname=계정)”-attr objectsid sIDHistory

728x90
728x90

$list = Import-Csv C:\Temp\sam.csv

New-Item -Path C:\Temp -Name sam_check_y.csv -ItemType file -Value ("id" + [Environment]::NewLine)
New-Item -Path C:\Temp -Name sam_check_n.csv -ItemType file -Value ("id" + [Environment]::NewLine)

foreach($user in $list )
 {
       $check_id = $user.id

        $user_yn = (Get-ADGroup -identity "EDGE_Dev@1" -properties Member).Member | Get-ADUser | where-object  {$_.SamaccountName -eq $check_id} | Select-Object samaccountname

        if($user_yn -eq $NULL) {
         $check_id |Add-Content -Path C:\Temp\sam_check_n.csv
         }

         if($user_yn -ne $NULL) {
          $check_id |Add-Content -Path C:\Temp\sam_check_y.csv
          }

}

728x90
728x90

원문 : lynckersriram.blogspot.com/2014/10/lync-presence-flow.html

 

Lync Presence Flow

What is Presence? Presence expresses the availability and willingness of a user to join a conversation by using a SIP client such as Mic...

lynckersriram.blogspot.com

현재 상태는 무엇입니까?

현재 상태는 사용자가 Microsoft Lync 2010 또는 Lync 2013과 같은 SIP 클라이언트를 사용하여 대화에 참여할 수있는 가능성과 의지를 나타냅니다. 현재 상태와 관련된 두 가지 주요 활동이 있습니다.

  • 프레즌스 출판
  • 프레즌스 구독

프레즌스 구독

현재 상태 구독은 새로 고침 된 현재 상태 정보를보고 싶은 사용자와 관심있는 향상된 현재 상태의 측면을 Lync 클라이언트가 알 수 있도록하는 작업입니다. Lync 클라이언트가 일련의 사용자 및 향상된 현재 상태 정보 집합이 있으면이 요청 또는 구독을 Lync 서버로 보냅니다. 그런 다음 Lync 서버는 Lync 클라이언트에 대한 응답으로 사용자에 대한 최신 정보로 응답합니다. 현재 상태 구독은 한 사용자가 다른 사용자의 업데이트 현재 상태 정보를 얻으려고 할 때 발생합니다.

 

프레즌스 출판

여기서 질문은 Lync 서버가 사용자의 현재 상태를 어떻게 알 수 있는가입니다. 현재 상태 게시는 사용자가이 현재 상태를 구독 한 다른 사용자의 사용을 위해 로그인 한 후 Lync 클라이언트를 사용하여 사용자 로컬 현재 상태 정보를 게시하는 것입니다. 응용 프로그램은 로컬 로그인 사용자의 현재 상태를 대화 가능, 바쁨, 방해 금지, 바로 돌아 오거나, 퇴근하거나 자리를 비움과 같은 가용성으로 설정할 수 있습니다. 현재 상태 게시는 한 사용자가 자신의 현재 상태 정보를 다른 사용자에게 업데이트하려고 할 때 발생합니다.

 

프레즌스 폴링

Lync Client에서 사용자의 연락처 목록을 관리하려면 연락처의 최신 현재 상태를 수신하려면 영구 구독이 필요합니다. 이러한 이유로 존재 여부에 대한 폴링은 정기적으로 필요합니다. 폴링은 정기적으로 프레즌스 구독을 수행합니다. 폴링 구독에서 Lync 클라이언트는 주기적으로 Lync 서버를 쿼리하여 데이터를 가져옵니다. 구독과 쿼리의 차이점은 구독이 일정 기간에 연결되어있는 반면 현재 상태 쿼리는 일회성이라는 사실에 있습니다. 영구 구독과 폴링 구독의 차이점은 SIP 대화 상자가 영구 구독에 관련되어 있지만 폴링 구독에 없다는 사실에 있습니다.

폴링 구독의 경우 Lync Server 클라이언트는 지정된 시간 간격으로 프로세스를 반복합니다. 영구 구독의 경우 Lync Server는 현재 상태 데이터가 포함 된 NOTIFY 또는 BENOTIFY 요청을 생성, 수정 또는 제거하여 구독자에게 게시를 푸시합니다. NOTIFY 요청의 경우 서버는 클라이언트가 SIP 응답으로 응답 할 것으로 예상합니다. BENOTIFY 요청의 경우 클라이언트 응답이 필요하지 않습니다. 프로세스는 구독이 종료 될 때까지, 구독 클라이언트의 요청에 따라 또는 구독 사용자가 로그 오프 할 때까지 계속됩니다.

 

사용자 존재 변경

사용자가 자신의 존재를 변경할 때. 사용자 용 Lync 클라이언트는 현재 상태 게시를 Lync 서버로 보냅니다. Lync는 현재 상태 업데이트를 위해 연락처로 추가 한 모든 사용자에게 알림 또는 Benotify 요청을 보냅니다.

728x90
728x90

Setting Skype, Skype for Business, Teams, Lync or Cisco Jabber as the default IM client for Outlook

I personally use Skype as my default IM client and that also integrated with Outlook at home. At work, we use Skype for Business and there Outlook integrates with Skype for Business.

I recently upgraded my home computer to Office 2016 via our company’s Office 365 licensing and now Skype no longer integrates with Outlook 2016. When I log on with Skype for Business at home, I found out that it now integrates with Outlook instead.

Do I need the Home or Personal edition of Office 2016 for integration with Skype or can I somehow set which IM client should integrate with Outlook?

Both Skype and Skype for Business (previously known as Lync), Microsoft Teams as well as Cisco Jabber can integrate with the IM functionality available in Outlook. This means that you can see people’s Skype, Teams or Jabber availability, reply to an email via an IM or directly start a call or chat all from within Outlook.

When you are using Skype or Jabber and then install an Office edition that includes Skype for Business, Skype for Business is set as the default IM client in Windows. Similarly, when you are using Skype for Business and then also install Skype or Jabber afterwards, it will set Skype or Jabber as the default. When you install Teams, it (currently) doesn’t set itself as the default IM client.

It would have been nice if there was an easy way to select your IM client for Outlook straight from within Outlook or the IM client itself. Sadly, this is not the case, except for Teams, but you can still set it directly via the Registry.

IM Providers Registry key

The Registry key which stores which IM client can integrate with Outlook is:

HKEY_CURRENT_USER\Software\IM Providers

Below this key, you’ll find several sub keys which represent the IM clients that you have installed on your system (and registered themselves as such).

In the IM Providers key, you’ll see a value called DefaultIMApp. This value should correspond to one of the sub keys. When you change the value of DefaultIMApp, restart Outlook and your new default IM application and Outlook should now use that as the application for IM integration.

When you want to use Skype for Business as the default, the DefaultIMApp value should be set to Lync as that was the previous name of Skype for Business and that name is still being used in several places for backwards compatibility.

If you don’t want to modify the Registry yourself, you can download the zip-file below. Within it, you’ll find ready made reg-files to set Skype, Skype for Business (Lync), Communicator or Cisco Jabber as the default IM application. Simply double click the correct reg-file to automatically set the value.

When you want to use Teams as the default IM client, you can do that directly from within Teams itself. For instructions, see the Microsoft Teams section below.

Download: defaultimclient.zip


Various IM clients can integrate with Outlook but choosing a default requires a Registry fix.

Note: Changing the default IM provider also affects the other Office applications of course. For instance, when you use the Contact Card in Backstage or the comment section in Word.

Microsoft Teams

Teams allows you to set itself as the default IM client directly from within its Settings dialog.

  • Click on your Avatar or initials in the top-right corner-> Settings-> section: General-> enable: Register Teams as the chat app for Office (requires restarting Office applications)


Registering Teams as the default chat app in Outlook and other Office applications.

Note: As expected, this will set the DefaultIMApp Registry value to Teams. The nice thing about this, is that when you don’t like it to be the default anymore, deselecting this option will set your previous chat app as the default again thanks to the PreviousDefaultIMApp value.

Supported IM clients

Please realize that you can’t simply pick any IM client and expect its integration to work in Outlook or other Office applications. If it doesn’t offer any Office integration features, setting this key to that application will disable the Reply with IM, chat, call and on-line availability functions in Outlook.

Amongst the supported IM clients are: Skype, Skype for Business, Lync, Office Communicator 2007 R2 and Cisco Jabber. The level of integration depends on a combination of the IM client being used and the version of Outlook.

Note: Windows Messenger got discontinued so setting MSN Messenger as the default is no longer supported.

728x90

+ Recent posts